]> git.phdru.name Git - ppu.git/blobdiff - tests/test_which.py
Version 0.4.0: Add script which.py
[ppu.git] / tests / test_which.py
diff --git a/tests/test_which.py b/tests/test_which.py
new file mode 100755 (executable)
index 0000000..5de5a64
--- /dev/null
@@ -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() == ''