Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,17 @@ def test_dir_cmd(self, mycmd):
assert which(mycmd) == mycmd

def test_cmd_path(self, tmpdir, mycmd):
path = str(tmpdir)
assert which('mycmd') is None
assert which('mycmd', path=path) == mycmd

os.environ['PATH'] = path + os.pathsep + \
os.environ.get('PATH', os.defpath)
assert which('mycmd') == mycmd
original_path = os.environ['PATH']
try:
path = str(tmpdir)
assert which('mycmd') is None
assert which('mycmd', path=path) == mycmd

os.environ['PATH'] = path + os.pathsep + \
os.environ.get('PATH', os.defpath)
assert which('mycmd') == mycmd
finally:
os.environ['PATH'] = original_path


@pytest.mark.skipif(not WINDOWS, reason='Not support non Windows')
Expand Down