Skip to content

Commit

Permalink
Tests: In other_interpreter_exe, try python3 -> python3.Y
Browse files Browse the repository at this point in the history
The "python" executable exists only if "python3" exists,
but "python3" can exist without "python".

This is at least the case in Fedora,
following https://peps.python.org/pep-0394/#for-python-runtime-distributors
  • Loading branch information
hroncok committed Oct 9, 2024
1 parent 254cd43 commit 753fa0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_tox_uv_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def other_interpreter_exe() -> pathlib.Path: # pragma: no cover

exe = pathlib.Path(sys.executable)
base_python: pathlib.Path | None = None
if exe.name == "python":
if exe.name in {"python", "python3"}:
# python -> pythonX.Y
ver = sys.version_info
base_python = exe.with_name(f"python{ver.major}.{ver.minor}")
elif exe.name[-1].isdigit():
# python X[.Y] -> python
# python X.Y -> python
base_python = exe.with_name(exe.stem[:-1])
elif exe.suffix == ".exe":
# python.exe <-> pythonw.exe
Expand Down

0 comments on commit 753fa0a

Please sign in to comment.