I have a Python module in which the setup.py script starts as follows:
import setuptools, pathlib
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
REQUIRES = (HERE / "requirements.txt").read_text().strip().split("\n")
setuptools.setup(
install_requires=REQUIRES,
long_description=README,
...
)
When I run the setup from the command line, like this:
python setup.py sdist
it runs fine. But when I run
tox
I get an error on line 5 in file setup.py:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
even though both the requirements.txt file and the README.md file remain in the same folder as setup.py.
Here is my tox.ini file:
[tox]
envlist = py39
[testenv]
deps =
pytest
-r requirements.txt
commands =
pytest
How can I make tox find my requirements.txt file?