X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=tests%2Ftest_which.py;fp=tests%2Ftest_which.py;h=5de5a64662e9c0fac685352d452aea235286cbc9;hb=78638a131663681fc9a89b246446978abb196325;hp=0000000000000000000000000000000000000000;hpb=0951dc82b8fad86308a0effdcf05223711c7f820;p=ppu.git diff --git a/tests/test_which.py b/tests/test_which.py new file mode 100755 index 0000000..5de5a64 --- /dev/null +++ b/tests/test_which.py @@ -0,0 +1,22 @@ +#! /usr/bin/env python + +import os +import subprocess +import sys +from ppu_tu import setup, teardown, find_in_path # noqa + + +tmp_dir = None + +test_prog_path = find_in_path('which.py') +if not test_prog_path: + sys.exit("Cannot find which.py in %s" % os.environ["PATH"]) + + +def test_which(): + assert subprocess.check_output( + [sys.executable, test_prog_path, "which.py"], + universal_newlines=True).strip() == test_prog_path + assert subprocess.check_output( + [sys.executable, test_prog_path, "WhoWhereWhenceWhichWhereIs.py"], + universal_newlines=True).strip() == ''