Repository: wntrblm/nox

Issue:
pypy-3.10 doesn't work as an interpreter name
### Current Behavior

GitHub Actions called PyPy interpreters `pypy-3.10`. I think we call them `pypy3.10`. Should we support the GHA form too?

Hints from issue comments:

Solution patch:
diff --git a/nox/virtualenv.py b/nox/virtualenv.py
index 2a8d8ba..4836827 100644
--- a/nox/virtualenv.py
+++ b/nox/virtualenv.py
@@ -453,6 +453,7 @@ class VirtualEnv(ProcessEnv):
               be ``py -3.6-32``
             * ``X.Y.Z``, e.g. ``3.4.9``
             * ``pythonX.Y``, e.g. ``python2.7``
+            * ``pypyX.Y``, e.g. ``pypy3.10`` (also ``pypy-3.10`` allowed)
             * A path in the filesystem to a Python executable
 
             If not specified, this will use the currently running Python.
@@ -472,6 +473,10 @@ class VirtualEnv(ProcessEnv):
         venv_backend: str = "virtualenv",
         venv_params: Sequence[str] = (),
     ):
+        # "pypy-" -> "pypy"
+        if interpreter and interpreter.startswith("pypy-"):
+            interpreter = interpreter[:4] + interpreter[5:]
+
         self.location_name = location
         self.location = os.path.abspath(location)
         self.interpreter = interpreter
diff --git a/noxfile.py b/noxfile.py
index 7531963..81dda9e 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -148,7 +148,8 @@ def docs(session: nox.Session) -> None:
 # The following sessions are only to be run in CI to check the nox GHA action
 def _check_python_version(session: nox.Session) -> None:
     if session.python.startswith("pypy"):
-        python_version = session.python[4:]
+        # Drop starting "pypy" and maybe "-"
+        python_version = session.python.lstrip("py-")
         implementation = "pypy"
     else:
         python_version = session.python
@@ -170,7 +171,7 @@ def _check_python_version(session: nox.Session) -> None:
 @nox.session(
     python=[
         *ALL_PYTHONS,
-        "pypy3.10",
+        "pypy-3.10",
     ],
     default=False,
 )


Test patch:
diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py
index 9f1a6e7..dcc620a 100644
--- a/tests/test_virtualenv.py
+++ b/tests/test_virtualenv.py
@@ -322,6 +322,16 @@ def test_constructor_defaults(
     assert venv.venv_backend == "virtualenv"
 
 
+def test_constructor_pypy_dash(
+    make_one: Callable[..., tuple[VirtualEnv, Path]],
+) -> None:
+    venv, _ = make_one(interpreter="pypy-3.10")
+    assert venv.location
+    assert venv.interpreter == "pypy3.10"
+    assert venv.reuse_existing is False
+    assert venv.venv_backend == "virtualenv"
+
+
 @pytest.mark.skipif(IS_WINDOWS, reason="Not testing multiple interpreters on Windows.")
 def test_constructor_explicit(
     make_one: Callable[..., tuple[VirtualEnv, Path]],