-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix python path resolution on linux (#1196)
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
|
||
import pytest # type: ignore | ||
|
||
from pipx import util | ||
from pipx.util import run_subprocess | ||
|
||
|
||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Path resolution skip if not on windows") | ||
def test_executable_path_resolution_unix(): | ||
cmd = ["python99.99", "-c", "import sys;"] | ||
try: | ||
run_subprocess(cmd) | ||
except FileNotFoundError as e: | ||
assert "No such file or directory: 'python99.99'" in str(e) | ||
|
||
|
||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Path resolution skip if not on windows") | ||
def test_executable_path_resolution_fails_on_unix_if_not_skipped(monkeypatch: pytest.MonkeyPatch): | ||
cmd = ["python99.99", "-c", "import sys;"] | ||
monkeypatch.setattr(util, "WINDOWS", True) | ||
monkeypatch.chdir("./tests") | ||
try: | ||
run_subprocess(cmd) | ||
except FileNotFoundError as e: | ||
assert "tests/python99.99'" in str(e) |