I am using nox
in order to test my code against different Python versions. I have a dependent package that is stored on my local hard drive. I add this package via poetry
with the following command:
poetry add ./path/to/package/local_package_py310.whl
My pyproject.toml
file then contains the following line in the [tool.poetry.dependencies]
section:
local_package = {path = "./path/to/package/local_package_py310.whl"}
This works fine for the regular Python version that I use (py 3.10). However, when using nox
to test my package under Python 3.9, I need to install a different version of this package, namely ./path/to/package/local_package_py39.whl
.
My noxfile.py
looks like this and the tests for 3.10 do pass.
@nox.session(python=["3.10", "3.9"])
def tests(session) -> None:
"""Run the test suite."""
session.run("poetry", "install", external=True)
session.run("pytest")
However, the test are failing for 3.9 due to the fact that in this case my pyproject.toml
is incorrect. It should read:
local_package = {path = "./path/to/package/local_package_py39.whl"}
Is it possible to modify the pyproject.toml
according to the Python version that nox
is using`?