diff --git a/docs/changelog/1374.bugfix.rst b/docs/changelog/1374.bugfix.rst new file mode 100644 index 000000000..4c052109f --- /dev/null +++ b/docs/changelog/1374.bugfix.rst @@ -0,0 +1 @@ +Fix ``PythonSpec`` detection of ``python3.10`` - by :user:`asottile` diff --git a/docs/changelog/1377.fix.rst b/docs/changelog/1377.bugfix.rst similarity index 100% rename from docs/changelog/1377.fix.rst rename to docs/changelog/1377.bugfix.rst diff --git a/src/tox/interpreters/py_spec.py b/src/tox/interpreters/py_spec.py index 104af4177..04c062e63 100644 --- a/src/tox/interpreters/py_spec.py +++ b/src/tox/interpreters/py_spec.py @@ -53,7 +53,7 @@ def from_name(cls, base_python): if os.path.isabs(base_python): path = base_python else: - match = re.match(r"(python|pypy|jython)(\d)?(?:\.(\d))?(-(32|64))?", base_python) + match = re.match(r"(python|pypy|jython)(\d)?(?:\.(\d+))?(-(32|64))?", base_python) if match: groups = match.groups() name = groups[0] diff --git a/tests/unit/interpreters/test_py_spec.py b/tests/unit/interpreters/test_py_spec.py new file mode 100644 index 000000000..48024afde --- /dev/null +++ b/tests/unit/interpreters/test_py_spec.py @@ -0,0 +1,6 @@ +from tox.interpreters.py_spec import PythonSpec + + +def test_py_3_10(): + spec = PythonSpec.from_name("python3.10") + assert (spec.major, spec.minor) == (3, 10)