Merge Christian Kampka's patch to give us distutils test running support.
This commit is contained in:
2
NEWS
2
NEWS
@@ -50,6 +50,8 @@ Improvements
|
|||||||
* ``setup.py`` can now build a snapshot when Bazaar is installed but the tree
|
* ``setup.py`` can now build a snapshot when Bazaar is installed but the tree
|
||||||
is not a Bazaar tree. (Jelmer Vernooij)
|
is not a Bazaar tree. (Jelmer Vernooij)
|
||||||
|
|
||||||
|
* Support for running tests using distutils (Christian Kampka, #726539)
|
||||||
|
|
||||||
* Vastly improved and extended documentation. (Jonathan Lange)
|
* Vastly improved and extended documentation. (Jonathan Lange)
|
||||||
|
|
||||||
* Use unittest2 exception classes if available. (Jelmer Vernooij)
|
* Use unittest2 exception classes if available. (Jelmer Vernooij)
|
||||||
|
|||||||
@@ -88,6 +88,34 @@ of them will happily run testtools tests. In particular:
|
|||||||
|
|
||||||
From now on, we'll assume that you know how to run your tests.
|
From now on, we'll assume that you know how to run your tests.
|
||||||
|
|
||||||
|
Running test with Distutils
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
If you are using Distutils_ to build your Python project, you can use the testtools
|
||||||
|
Distutils_ command to integrate testtools into your Distutils_ workflow::
|
||||||
|
|
||||||
|
from distutils.core import setup
|
||||||
|
from testtools import TestCommand
|
||||||
|
setup(name='foo',
|
||||||
|
version='1.0',
|
||||||
|
py_modules=['foo'],
|
||||||
|
cmdclass={'test': TestCommand}
|
||||||
|
)
|
||||||
|
|
||||||
|
You can then run::
|
||||||
|
|
||||||
|
$ python setup.py test -m exampletest
|
||||||
|
Tests running...
|
||||||
|
Ran 2 tests in 0.000s
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
For more information about the capabilities of the `TestCommand` command see::
|
||||||
|
|
||||||
|
$ python setup.py test --help
|
||||||
|
|
||||||
|
You can use the `setup configuration`_ to specify the default behavior of the
|
||||||
|
`TestCommand` command.
|
||||||
|
|
||||||
Assertions
|
Assertions
|
||||||
==========
|
==========
|
||||||
@@ -1098,3 +1126,5 @@ You can do::
|
|||||||
.. _Deferred: http://twistedmatrix.com/documents/current/core/howto/defer.html
|
.. _Deferred: http://twistedmatrix.com/documents/current/core/howto/defer.html
|
||||||
.. _discover: http://pypi.python.org/pypi/discover
|
.. _discover: http://pypi.python.org/pypi/discover
|
||||||
.. _`testtools API docs`: http://mumak.net/testtools/apidocs/
|
.. _`testtools API docs`: http://mumak.net/testtools/apidocs/
|
||||||
|
.. _Distutils: http://docs.python.org/library/distutils.html
|
||||||
|
.. _`setup configuration`: http://docs.python.org/distutils/configfile.html
|
||||||
|
|||||||
4
setup.cfg
Normal file
4
setup.cfg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[test]
|
||||||
|
test_module = testtools.tests
|
||||||
|
buffer=1
|
||||||
|
catch=1
|
||||||
@@ -61,6 +61,9 @@ from testtools.testsuite import (
|
|||||||
ConcurrentTestSuite,
|
ConcurrentTestSuite,
|
||||||
iterate_tests,
|
iterate_tests,
|
||||||
)
|
)
|
||||||
|
from testtools.distutilscmd import (
|
||||||
|
TestCommand,
|
||||||
|
)
|
||||||
|
|
||||||
# same format as sys.version_info: "A tuple containing the five components of
|
# same format as sys.version_info: "A tuple containing the five components of
|
||||||
# the version number: major, minor, micro, releaselevel, and serial. All
|
# the version number: major, minor, micro, releaselevel, and serial. All
|
||||||
|
|||||||
Reference in New Issue
Block a user