diff options
author | Anish Athalye <me@anishathalye.com> | 2017-04-18 22:18:58 -0400 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2017-04-19 08:40:15 -0400 |
commit | 53eb3851d1115bc825bdf1c4d6f9407e8ff414d4 (patch) | |
tree | 64b965f3c7daa21c2df5f4e6b414ae5a35388a2c /test | |
parent | 32aa4759038dde21cc3b10960c99f0290fe11c5d (diff) |
Make launcher find python binary
Diffstat (limited to 'test')
-rw-r--r-- | test/tests/find-python-executable.bash | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/tests/find-python-executable.bash b/test/tests/find-python-executable.bash new file mode 100644 index 0000000..cc46724 --- /dev/null +++ b/test/tests/find-python-executable.bash @@ -0,0 +1,58 @@ +test_description='can find python executable with different names' +. '../test-lib.bash' + +# the test machine needs to have a binary named `python` +test_expect_success 'setup' ' +mkdir ~/tmp_bin && +( + IFS=: + for p in $PATH; do + find $p -maxdepth 1 -mindepth 1 -exec sh -c \ + '"'"'ln -sf {} $HOME/tmp_bin/$(basename {})'"'"' \; + done +) && +rm -f ~/tmp_bin/python && +rm -f ~/tmp_bin/python2 && +rm -f ~/tmp_bin/python3 +' + +test_expect_failure 'run' ' +PATH="$HOME/tmp_bin" run_dotbot <<EOF +[] +EOF +' + +test_expect_success 'setup 2' ' +touch ~/tmp_bin/python && +chmod +x ~/tmp_bin/python && +cat >> ~/tmp_bin/python <<EOF +#!$HOME/tmp_bin/sh +exec $(which python) +EOF +' + +test_expect_success 'run 2' ' +PATH="$HOME/tmp_bin" run_dotbot <<EOF +[] +EOF +' + +test_expect_success 'setup 3' ' +mv ~/tmp_bin/python ~/tmp_bin/python2 +' + +test_expect_success 'run 3' ' +PATH="$HOME/tmp_bin" run_dotbot <<EOF +[] +EOF +' + +test_expect_success 'setup 4' ' +mv ~/tmp_bin/python2 ~/tmp_bin/python3 +' + +test_expect_success 'run 4' ' +PATH="$HOME/tmp_bin" run_dotbot <<EOF +[] +EOF +' |