Setup scripts can use pytest-runner to add setup.py test support for pytest runner.
- Add ‘pytest-runner’ to your ‘setup_requires’. Pin to ‘>=1.0,<2.0dev’ (or similar) to avoid pulling in incompatible versions.
- Include ‘pytest’ and any other testing requirements to ‘tests_require’.
- Invoke tests with setup.py ptr.
Include the file ptr.py in your repo.
Add these lines to your setup.py:
execfile('ptr.py') setup_params = PyTest.install(dict(...)) setuptools.setup(**setup_params)
Where ‘…’ are your normal keyword parameters to setup().
Invoke your tests with setup.py test.
- Added support for –addopts to pass any arguments through to py.test.
- Deprecated support for –junitxml. Use –addopts instead. –junitxml will be removed in 2.0.