While using pbr to simplify Python packaging what do we need to configure in order to make it use pytest when python setup.py test command is executed.
Running pytest works without any problems.
In setup.py:
setup(
setup_requires=['pbr>=1.9', 'setuptools>=17.1', 'pytest-runner'],
pbr=True,
)
In setup.cfg (after standard pbr config):
[aliases]
test=pytest
In test-requirements.txt (same directory as requirements.txt):
pytest
If your tests are outside the application code, you will also need to specify your test directory using addopts in setup.cfg. For example, if your directory structure looks like the first example on this page, you should have
[tool:pytest]
addopts = tests
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