From 59771460ba287fb318c38c3c930c0b01a22f6bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sun, 4 Dec 2022 21:55:56 -0800 Subject: [PATCH] Py marker means any python not CPython MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2460.bugfix.rst | 1 + src/virtualenv/discovery/py_spec.py | 2 +- tests/unit/discovery/test_py_spec.py | 5 ++--- tox.ini | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 docs/changelog/2460.bugfix.rst diff --git a/docs/changelog/2460.bugfix.rst b/docs/changelog/2460.bugfix.rst new file mode 100644 index 000000000..60cd16662 --- /dev/null +++ b/docs/changelog/2460.bugfix.rst @@ -0,0 +1 @@ +A ``py`` or ``python`` spec means any Python rather than ``CPython`` - by :user:`gaborbernat`. diff --git a/src/virtualenv/discovery/py_spec.py b/src/virtualenv/discovery/py_spec.py index 058d8be35..103c7ae66 100644 --- a/src/virtualenv/discovery/py_spec.py +++ b/src/virtualenv/discovery/py_spec.py @@ -56,7 +56,7 @@ def _int_or_none(val): else: impl = groups["impl"] if impl == "py" or impl == "python": - impl = "CPython" + impl = None arch = _int_or_none(groups["arch"]) if not ok: diff --git a/tests/unit/discovery/test_py_spec.py b/tests/unit/discovery/test_py_spec.py index ba1b00ee7..641429ead 100644 --- a/tests/unit/discovery/test_py_spec.py +++ b/tests/unit/discovery/test_py_spec.py @@ -1,4 +1,3 @@ -import itertools import sys from copy import copy @@ -46,7 +45,7 @@ def test_spec_satisfies_arch(): @pytest.mark.parametrize( ("req", "spec"), - list(itertools.combinations(["py", "CPython", "python"], 2)) + [("jython", "jython")] + [("CPython", "cpython")], + [("py", "python"), ("jython", "jython"), ("CPython", "cpython")], ) def test_spec_satisfies_implementation_ok(req, spec): spec_1 = PythonSpec.from_string_spec(req) @@ -56,7 +55,7 @@ def test_spec_satisfies_implementation_ok(req, spec): def test_spec_satisfies_implementation_nok(): - spec_1 = PythonSpec.from_string_spec("python") + spec_1 = PythonSpec.from_string_spec("cpython") spec_2 = PythonSpec.from_string_spec("jython") assert spec_2.satisfies(spec_1) is False assert spec_1.satisfies(spec_2) is False diff --git a/tox.ini b/tox.ini index 4396d1a88..53fc515b1 100644 --- a/tox.ini +++ b/tox.ini @@ -67,7 +67,7 @@ setenv = skip_install = true deps = coverage>=6.5 - diff_cover>=7.1 + diff_cover>=7.2 extras = parallel_show_output = true commands = @@ -91,7 +91,7 @@ description = check that the long description is valid (need for PyPI) skip_install = true deps = build>=0.9 - twine>=4.0.1 + twine>=4.0.2 extras = commands = python -m build -o {envtmpdir} --wheel --sdist .