I have a python project and I have tried to follow the Hypermodern Python Project guidelines for testing with Poetry
and nox
and pyenv
.
This is on Debian 10 running on WLS2.
> lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
I have these versions of Python installed with pyenv
:
> pyenv versions
system
3.10.2
* 3.7.12
* 3.8.12
* 3.9.10
and versions 3.7.12, 3.8.12 and 3.9.10 are enabled for this project with pyenv local
.
In my noxfile.py
my tests
session is like this:
@session(python=["3.7", "3.9", "3.8"])
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".")
session.install("coverage[toml]", "pytest")
session.run("pytest", *args)
I would expect that when I invoke nox
to run my tests with poetry run nox -s tests
, it would run in all three of these versions of Python, as shown in the Hypermodern example.
Instead, I see this:
nox > Running session tests-3.7
nox > Creating virtual environment (virtualenv) using python3.7 in .nox/tests-3-7
nox > poetry build --format=wheel
...
nox > Session tests-3.7 was successful.
nox > Running session tests-3.9
nox > Session tests-3.9 skipped: Python interpreter 3.9 not found.
nox > Running session tests-3.8
nox > Session tests-3.8 skipped: Python interpreter 3.8 not found.
nox > Ran multiple sessions:
nox > * tests-3.7: success
nox > * tests-3.9: skipped
nox > * tests-3.8: skipped
I have tried various combinations of pyenv global
and pyenv local
. I have run poetry upgrade
after setting the multiple version with pyenv
. Ditto re-running poetry install
.
I have been unsuccessful searching for an answer on the interwebs and I'm hoping someone here can point me on the right path.
I ran pyenv shell 3.8.12
etc., as hinted in a related StackOverflow, but that did not seem to do the trick. That same article suggested updating ~/.profile
and ~/.bashrc
, but that did not help either.
I uninstalled and reinstalled poetry
:
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | python3 -
and no change.
I also chased the ideas from this StackOverflow, to no avail.