I have the following project structure:
root
|- module
|- module.py
|- __init__.py
|- tests
|- unit
|- some_test.py
|- integration
|- another_test.py
|- conftest.py
|- setup.py
|- tox.ini
When I run python3 module/module.py ...
it runs as expected.
However, when I execute tox
, I get ModuleNotFoundError: No module named 'dateutil'
.
In my setup.py I have install_requires=['python-dateutil']
and tox.ini has the following (simplified) contents:
[tox]
envlist = py{36, 37}
skipsdist = True
[testenv]
deps = pytest
commands = pytest
Does anyone have any insight as to why running tox
gives me that the module 'dateutil' cannot be found and how to fix it?
[tox]skipsdist = True
prevents tox
to run python setup.py sdist
so your install_requires
is completely ignored.
If you really want to follow the advice to set [tox]skipsdist = True
for applications you are also advised to follow all other best practices for packaging applications: use requirements.txt
and add
[testenv]
deps =
-rrequirements.txt
to tox.ini
. Or just directly
[testenv]
deps = python-dateutil
What helped me:
install_requires
section of the setup.py
.tox
directory and re-run tox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With