Reputation: 1801
I am trying to learn how to use tox for python unit testing on multiple python installations. I have used pyenv
to install multiple python installations to the /home/username/.pyenv/versions/version_number/bin/python
, where version_number
could be 3.9.16, or 3.10.9. I have added the following lines to my pyproject.toml
file. I have a simple test directory structure that looks like
hello
|_ pyproject.toml
|_ hello
| |_ __init__.py
| |_ main.py
|_tests
| |_ __init__.py
|_ test_main.py
Among other lines in my pyproject.toml
file I have the following tox
config lines
[tool.pytest.ini_options]
testpaths = ["tests"]
console_output_style = "progress"
[tool.tox]
legacy_tox_ini = """
[tox]
env_list = py39, py310, mypy
[testenv]
deps =
pytest
[testenv:py39]
basepython = /home/jonwebb/.pyenv/versions/3.9.16/bin/python
[testenv:py310]
basepython = /home/jonwebb/.pyenv/versions/3.10.9/bin/python
[testenv:mypy]
deps = mypy
commands = mypy hello
"""
When I try to run tox from the uppermost hello
directory I get an error stating;
py39: failed with env name py39 conflicting with base python /home/username/.pyenv/version/3.9.16/bin/python
py310: failed with env name py310 conflicting with base python /home/username/.pyenv/versions/3.10.9/bin/python
It appears that tox
is having problems with my python installations created with pyenv
. How can I fix this installation so it recognizes my python installations installed with pyenv
? It is probably worth noting that this code implementation is using a local .venv folder created with poetry
.
Upvotes: 1
Views: 514
Reputation: 6121
You need to remove the basepython
directives from your tox.ini
.
Upvotes: 2