Skip to content

Commit

Permalink
Fail on mismatched python spec attributes (#2824)
Browse files Browse the repository at this point in the history
Closes #2754
  • Loading branch information
stephenfin committed Jan 5, 2023
1 parent af4b558 commit fc289c0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changelog/2754.bugfix.rst
@@ -0,0 +1,2 @@
Setting ``[testenv] basepython = python3`` will no longer override the Python interpreter version requested by a factor,
such as ``py311`` - by :user:`stephenfin`.
2 changes: 1 addition & 1 deletion src/tox/tox_env/python/api.py
Expand Up @@ -154,7 +154,7 @@ def _validate_base_python(env_name: str, base_pythons: list[str], ignore_base_py
if any(
getattr(spec_base, key) != getattr(spec_name, key)
for key in ("implementation", "major", "minor", "micro", "architecture")
if getattr(spec_base, key) is not None and getattr(spec_name, key) is not None
if getattr(spec_name, key) is not None
):
msg = f"env name {env_name} conflicting with base python {base_python}"
if ignore_base_python_conflict:
Expand Down
1 change: 1 addition & 0 deletions tests/tox_env/python/test_python_api.py
Expand Up @@ -95,6 +95,7 @@ def test_base_python_env_no_conflict(env: str, base_python: list[str], ignore_co
("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"]),
Expand Down

0 comments on commit fc289c0

Please sign in to comment.