]> git.phdru.name Git - ppu.git/blob - tests/test_which.py
Build(GHActions): Use `checkout@v4` instead of outdated `v2`
[ppu.git] / tests / test_which.py
1 #! /usr/bin/env python
2
3 import os
4 import subprocess
5 import sys
6 from ppu_tu import setup, teardown, find_in_path  # noqa
7
8
9 test_prog_path = find_in_path('which.py')
10
11 if sys.platform == 'win32':
12     os_env_pathext = os.environ['PATHEXT']
13     pathext = os_env_pathext.lower().split(os.pathsep)
14     if '.py' not in pathext:
15         os_env_pathext += ';.py'
16         os.environ['PATHEXT'] = os_env_pathext
17
18
19 def test_which():
20     assert subprocess.check_output(
21         [sys.executable, test_prog_path, "which.py"],
22         universal_newlines=True).strip() == test_prog_path
23     assert subprocess.check_output(
24         [sys.executable, test_prog_path, "WhoWhereWhenceWhichWhereIs.py"],
25         universal_newlines=True).strip() == ''