document integration with setuptools/distribute test command and tests_require
This commit is contained in:
parent
ee8d2f9950
commit
2b0887fa5f
|
@ -3,6 +3,8 @@ Changese between 2.2.3 and ...
|
||||||
|
|
||||||
- fix issue 126: correctly match all invalid xml characters for junitxml
|
- fix issue 126: correctly match all invalid xml characters for junitxml
|
||||||
binary escape
|
binary escape
|
||||||
|
- document integration with the extended distribute/setuptools test commands
|
||||||
|
|
||||||
|
|
||||||
Changes between 2.2.2 and 2.2.3
|
Changes between 2.2.2 and 2.2.3
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
|
@ -94,6 +94,40 @@ options.
|
||||||
.. _`test discovery`:
|
.. _`test discovery`:
|
||||||
.. _`Python test discovery`:
|
.. _`Python test discovery`:
|
||||||
|
|
||||||
|
|
||||||
|
Integration with setuptools/distribute test commands
|
||||||
|
----------------------------------------------------
|
||||||
|
|
||||||
|
Distribute/Setuptools support test requirements,
|
||||||
|
which means its really easy to extend its test command
|
||||||
|
to support running a pytest from test requirements::
|
||||||
|
|
||||||
|
from setuptools.command.test import test as TestCommand
|
||||||
|
|
||||||
|
class PyTest(TestCommand):
|
||||||
|
def finalize_options(self):
|
||||||
|
TestCommand.finalize_options(self)
|
||||||
|
self.test_args = []
|
||||||
|
self.test_suite = True
|
||||||
|
def run_tests(self):
|
||||||
|
#import here, cause outside the eggs aren't loaded
|
||||||
|
import pytest
|
||||||
|
pytest.main(self.test_args)
|
||||||
|
|
||||||
|
setup(
|
||||||
|
...,
|
||||||
|
tests_require=['pytest'],
|
||||||
|
cmdclass = {'test': pytest},
|
||||||
|
)
|
||||||
|
|
||||||
|
Now if you run::
|
||||||
|
|
||||||
|
python setup.py test
|
||||||
|
|
||||||
|
this will download py.test if needed and then run py.test
|
||||||
|
as you would expect it to.
|
||||||
|
|
||||||
|
|
||||||
Conventions for Python test discovery
|
Conventions for Python test discovery
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue