Why am I gettin a RuntimeError when running tests with nox?

135 Views Asked by At

I'm working on a Python module that should work for versions 3.7 to 3.11 of Python. I'm using nox to run the tests in multiple versions. My noxfile.py looks like this:

import nox

@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def tests(session):
    session.install("pytest")
    session.run("pytest")

When I run the nox command I receive the followin error:

nox > Running session tests-3.7
nox > Creating virtual environment (virtualenv) using python3.7 in .nox/tests-3-7
nox > Command /Users/mariovagomarzal/Projects/python_project/venv/bin/python -m virtualenv /Users/mariovagomarzal/Projects/python_project/.nox/tests-3-7 -p python3.7 failed with exit code 1:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7'
nox > Session tests-3.7 failed.
nox > Running session tests-3.8
nox > Creating virtual environment (virtualenv) using python3.8 in .nox/tests-3-8
nox > Command /Users/mariovagomarzal/Projects/python_project/venv/bin/python -m virtualenv /Users/mariovagomarzal/Projects/python_project/.nox/tests-3-8 -p python3.8 failed with exit code 1:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.8'
nox > Session tests-3.8 failed.

The other versions of Python work without problem. How can I solve this problem?

0

There are 0 best solutions below