find . -name '*.py' -print0 | xargs -0 mypy --strict --ignore-missing-imports
for test in tests/*;do
- "$test"
+ if [ ! -d "$test" ];then
+ "$test"
+ fi
done
find . -name '*_test.py' -print0 | xargs -0 -r -n1 python3
#!/bin/sh
-set -e
-
-repo_dir="`mktemp -d`"
-repo="$repo_dir/repo"
-git init "$repo"
-(
- cd "$repo"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf="`mktemp`"
-cat > "$conf" <<EOF
-[foo]
-git_repo = file://$repo
-git_ref = master
+. ./tests/lib/test-setup.sh
+foo_setup
+
+cat >> "$conf" <<EOF
[bar]
alias_of = foo
EOF
actual_env_command=`python3 ./pinch.py update --dry-run "$conf"`
-rm -rf "$repo_dir" "$conf"
+foo_cleanup
expected_env_command_RE='^nix-env --profile /nix/var/nix/profiles/per-user/[^/]+/channels --show-trace --file '\''<nix/unpack-channel.nix>'\'' --install --from-expression '\''f: f \{ name = "(repo-[0-9]{10}-[0-9a-f]{11})"; channelName = "bar"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\'' '\''f: f \{ name = "\1"; channelName = "foo"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\''$'
#!/bin/sh
-set -e
+. ./tests/lib/test-setup.sh
-repo_dir="`mktemp -d`"
-repo="$repo_dir/repo"
-git init "$repo"
-(
- cd "$repo"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf="`mktemp`"
-cat > "$conf" <<EOF
-[foo]
-git_repo = file://$repo
-git_ref = master
-EOF
+foo_setup
python3 ./pinch.py pin "$conf"
actual_env_command=`python3 ./pinch.py update --dry-run "$conf"`
-rm -rf "$repo_dir" "$conf"
+foo_cleanup
expected_env_command_RE='^nix-env --profile /nix/var/nix/profiles/per-user/[^/]+/channels --show-trace --file '\''<nix/unpack-channel.nix>'\'' --install --from-expression '\''f: f \{ name = "(repo-[0-9]{10}-[0-9a-f]{11})"; channelName = "foo"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\''$'
--- /dev/null
+set -e
+
+foo_setup() {
+
+ repo_dir="`mktemp -d`"
+ repo="$repo_dir/repo"
+ git init "$repo"
+ (
+ cd "$repo"
+ echo Contents > test-file
+ git add test-file
+ git commit -m 'Commit message'
+ )
+
+ conf="`mktemp`"
+ cat > "$conf" <<EOF
+[foo]
+git_repo = file://$repo
+git_ref = master
+EOF
+
+}
+
+foo_cleanup() {
+ rm -rf "$repo_dir" "$conf"
+}
#!/bin/sh
-set -e
-
-repo_dir="`mktemp -d`"
-repo="$repo_dir/repo"
-git init "$repo"
-(
- cd "$repo"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf1="`mktemp`"
-cat > "$conf1" <<EOF
-[foo]
-git_repo = file://$repo
-git_ref = master
-EOF
+. ./tests/lib/test-setup.sh
+
+foo_setup
conf2="`mktemp`"
cat > "$conf2" <<EOF
alias_of = foo
EOF
-python3 ./pinch.py pin "$conf1"
+python3 ./pinch.py pin "$conf"
python3 ./pinch.py pin "$conf2"
-actual_env_command=`python3 ./pinch.py update --dry-run "$conf1" "$conf2"`
+actual_env_command=`python3 ./pinch.py update --dry-run "$conf" "$conf2"`
-rm -rf "$repo_dir" "$conf1" "$conf2"
+foo_cleanup
+rm -rf "$conf2"
expected_env_command_RE='^nix-env --profile /nix/var/nix/profiles/per-user/[^/]+/channels --show-trace --file '\''<nix/unpack-channel.nix>'\'' --install --from-expression '\''f: f \{ name = "(repo-[0-9]{10}-[0-9a-f]{11})"; channelName = "bar"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\'' '\''f: f \{ name = "\1"; channelName = "foo"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\''$'
#!/bin/sh
-set -e
+. ./tests/lib/test-setup.sh
-repo_dir="`mktemp -d`"
-repo="$repo_dir/repo"
-git init "$repo"
-(
- cd "$repo"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf="`mktemp`"
-cat > "$conf" <<EOF
-[foo]
-git_repo = file://$repo
-git_ref = master
-EOF
+foo_setup
python3 ./pinch.py pin "$conf"
actual_env_command=`python3 ./pinch.py update --dry-run "$conf"`
-rm -rf "$repo_dir" "$conf"
+foo_cleanup
expected_env_command_RE='^nix-env --profile /nix/var/nix/profiles/per-user/[^/]+/channels --show-trace --file '\''<nix/unpack-channel.nix>'\'' --install --from-expression '\''f: f \{ name = "(repo-[0-9]{10}-[0-9a-f]{11})"; channelName = "foo"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\''$'
#!/bin/sh
-set -e
-
-repo_dir1="`mktemp -d`"
-repo1="$repo_dir1/repo"
-git init "$repo1"
-(
- cd "$repo1"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-repo_dir2="`mktemp -d`"
-repo2="$repo_dir2/repo"
-git init "$repo2"
-(
- cd "$repo2"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf1="`mktemp`"
-cat > "$conf1" <<EOF
-[same]
-git_repo = file://$repo1
-git_ref = master
-EOF
-
-conf2="`mktemp`"
-cat > "$conf2" <<EOF
-[same]
-git_repo = file://$repo2
-git_ref = master
-EOF
+. ./tests/lib/test-setup.sh
+
+foo_setup
+
+repo_dir1=$repo_dir
+repo1=$repo
+conf1=$conf
+
+foo_setup
python3 ./pinch.py pin "$conf1"
-python3 ./pinch.py pin "$conf2"
+python3 ./pinch.py pin "$conf"
-if python3 ./pinch.py update --dry-run "$conf1" "$conf2";then
+if python3 ./pinch.py update --dry-run "$conf1" "$conf";then
echo "FAIL: Duplicate names should be rejected"
exit 1
else
echo PASS
fi
-rm -rf "$repo_dir1" "$repo_dir2" "$conf1" "$conf2"
+foo_cleanup
+
+repo_dir=$repo_dir1
+repo=$repo1
+conf=$conf1
+foo_cleanup
#!/bin/sh
-set -e
+. ./tests/lib/test-setup.sh
-repo_dir="`mktemp -d`"
-repo="$repo_dir/repo"
-git init "$repo"
-(
- cd "$repo"
- echo Contents > test-file
- git add test-file
- git commit -m 'Commit message'
-)
-
-conf="`mktemp`"
-cat > "$conf" <<EOF
-[foo]
-git_repo = file://$repo
-git_ref = master
-EOF
+foo_setup
python3 ./pinch.py pin "$conf"
echo PASS
fi
-rm -rf "$repo_dir" "$conf"
+foo_cleanup