summaryrefslogtreecommitdiff
path: root/tests/tox_env/python/test_python_api.py
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2023-01-10 17:34:00 +0000
committerGitHub <noreply@github.com>2023-01-10 09:34:00 -0800
commit34b79a2514f8ab1675d6b928fa7e83268c8bd78e (patch)
tree605340e52fd3b235901bee42ac88c2360150a731 /tests/tox_env/python/test_python_api.py
parentce2e8dbac7905b8b4b6d49c8bcd8a7d72f46373f (diff)
downloadtox-git-34b79a2514f8ab1675d6b928fa7e83268c8bd78e.tar.gz
Only return Python factor on base_python conflict (#2840)
Fixes https://github.com/tox-dev/tox/issues/2838
Diffstat (limited to 'tests/tox_env/python/test_python_api.py')
-rw-r--r--tests/tox_env/python/test_python_api.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/tests/tox_env/python/test_python_api.py b/tests/tox_env/python/test_python_api.py
index b11c4376..725eab05 100644
--- a/tests/tox_env/python/test_python_api.py
+++ b/tests/tox_env/python/test_python_api.py
@@ -87,26 +87,35 @@ def test_base_python_env_no_conflict(env: str, base_python: list[str], ignore_co
@pytest.mark.parametrize("ignore_conflict", [True, False])
@pytest.mark.parametrize(
- ("env", "base_python", "conflict"),
+ ("env", "base_python", "expected", "conflict"),
[
- ("cpython", ["pypy"], ["pypy"]),
- ("pypy", ["cpython"], ["cpython"]),
- ("pypy2", ["pypy3"], ["pypy3"]),
- ("py3", ["py2"], ["py2"]),
- ("py38", ["py39"], ["py39"]),
- ("py38", ["py38", "py39"], ["py39"]),
- ("py38", ["python3"], ["python3"]),
- ("py310", ["py38", "py39"], ["py38", "py39"]),
- ("py3.11.1", ["py3.11.2"], ["py3.11.2"]),
- ("py3-64", ["py3-32"], ["py3-32"]),
- ("py310-magic", ["py39"], ["py39"]),
+ ("cpython", ["pypy"], "cpython", ["pypy"]),
+ ("pypy", ["cpython"], "pypy", ["cpython"]),
+ ("pypy2", ["pypy3"], "pypy2", ["pypy3"]),
+ ("py3", ["py2"], "py3", ["py2"]),
+ ("py38", ["py39"], "py38", ["py39"]),
+ ("py38", ["py38", "py39"], "py38", ["py39"]),
+ ("py38", ["python3"], "py38", ["python3"]),
+ ("py310", ["py38", "py39"], "py310", ["py38", "py39"]),
+ ("py3.11.1", ["py3.11.2"], "py3.11.1", ["py3.11.2"]),
+ ("py3-64", ["py3-32"], "py3-64", ["py3-32"]),
+ ("py310-magic", ["py39"], "py310", ["py39"]),
],
ids=lambda a: "|".join(a) if isinstance(a, list) else str(a),
)
-def test_base_python_env_conflict(env: str, base_python: list[str], conflict: list[str], ignore_conflict: bool) -> None:
+def test_base_python_env_conflict(
+ env: str,
+ base_python: list[str],
+ expected: str,
+ conflict: list[str],
+ ignore_conflict: bool,
+) -> None:
+ if env == "py3-64":
+ raise pytest.skip("bug #2657")
+
if ignore_conflict:
result = Python._validate_base_python(env, base_python, ignore_conflict)
- assert result == [env]
+ assert result == [expected]
else:
msg = f"env name {env} conflicting with base python {conflict[0]}"
with pytest.raises(Fail, match=msg):