Commits

holger krekel committed 7b67cc5 Merge

Merged in tbekolay/pytest/tbekolay/better-setuptools-integration-in-goodpra-1400520902689 (pull request #171)

Better setuptools integration in goodpractices

Comments (0)

Files changed (1)

doc/en/goodpractises.txt

 
 
     class PyTest(TestCommand):
+        user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
+
+        def initialize_options(self):
+            TestCommand.initialize_options(self)
+            self.pytest_args = None
+
         def finalize_options(self):
             TestCommand.finalize_options(self)
             self.test_args = []
         def run_tests(self):
             #import here, cause outside the eggs aren't loaded
             import pytest
-            errno = pytest.main(self.test_args)
+            errno = pytest.main(self.pytest_args)
             sys.exit(errno)
 
 
     python setup.py test
 
 this will download ``pytest`` if needed and then run your tests
-as you would expect it to.
+as you would expect it to. You can pass a single string of arguments
+using the ``--pytest-args`` or ``-a`` command-line option. For example::
+
+    python setup.py test -a "--durations=5"
+
+is equivalent to running ``py.test --durations=5``.
 
 .. _`test discovery`:
 .. _`Python test discovery`: