Merge lp:~kampka/testtools/issue-726539 into lp:~testtools-committers/testtools/trunk

Proposed by Christian Kampka
Status: Merged
Merged at revision: 178
Proposed branch: lp:~kampka/testtools/issue-726539
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 69 lines (+39/-0)
3 files modified
doc/for-test-authors.rst (+30/-0)
setup.cfg (+6/-0)
testtools/__init__.py (+3/-0)
To merge this branch: bzr merge lp:~kampka/testtools/issue-726539
Reviewer Review Type Date Requested Status
Jonathan Lange Approve
Review via email: mp+51753@code.launchpad.net

Description of the change

* Fixes TestCommand import and reexports it from the testtools package
* Adds a sample setup.cfg configuration for the distutils TestCommand
  to demonstrate the proper usage of the command and so that
  ``python setup.py test`` may actually do something useful by default

To post a comment you must log in.
lp:~kampka/testtools/issue-726539 updated
177. By Christian Kampka

* added basic documentation on how to use testtools with distutils

Revision history for this message
Jonathan Lange (jml) wrote :

Thanks so much for this patch, especially since it comes with documentation! Very sorry about the delay. I've merged your patch with some minor tweaks (NEWS, removed commented-out lines, changed "You can the run" to "You can then run").

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/for-test-authors.rst'
2--- doc/for-test-authors.rst 2011-01-22 16:47:31 +0000
3+++ doc/for-test-authors.rst 2011-03-14 21:32:18 +0000
4@@ -88,6 +88,34 @@
5
6 From now on, we'll assume that you know how to run your tests.
7
8+Running test with Distutils
9+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10+
11+If you are using Distutils_ to build your Python project, you can use the testtools
12+Distutils_ command to integrate testtools into your Distutils_ workflow::
13+
14+ from distutils.core import setup
15+ from testtools import TestCommand
16+ setup(name='foo',
17+ version='1.0',
18+ py_modules=['foo'],
19+ cmdclass={'test': TestCommand}
20+ )
21+
22+You can the run::
23+
24+ $ python setup.py test -m exampletest
25+ Tests running...
26+ Ran 2 tests in 0.000s
27+
28+ OK
29+
30+For more information about the capabilities of the `TestCommand` command see::
31+
32+ $ python setup.py test --help
33+
34+You can use the `setup configuration`_ to specify the default behavior of the
35+`TestCommand` command.
36
37 Assertions
38 ==========
39@@ -1098,3 +1126,5 @@
40 .. _Deferred: http://twistedmatrix.com/documents/current/core/howto/defer.html
41 .. _discover: http://pypi.python.org/pypi/discover
42 .. _`testtools API docs`: http://mumak.net/testtools/apidocs/
43+.. _Distutils: http://docs.python.org/library/distutils.html
44+.. _`setup configuration`: http://docs.python.org/distutils/configfile.html
45
46=== added file 'setup.cfg'
47--- setup.cfg 1970-01-01 00:00:00 +0000
48+++ setup.cfg 2011-03-14 21:32:18 +0000
49@@ -0,0 +1,6 @@
50+[test]
51+test_module = testtools.tests
52+;test_suite = testtools.tests.test_suite
53+;failfast=1
54+buffer=1
55+catch=1
56
57=== modified file 'testtools/__init__.py'
58--- testtools/__init__.py 2011-02-14 14:53:41 +0000
59+++ testtools/__init__.py 2011-03-14 21:32:18 +0000
60@@ -61,6 +61,9 @@
61 ConcurrentTestSuite,
62 iterate_tests,
63 )
64+from testtools.distutilscmd import (
65+ TestCommand,
66+)
67
68 # same format as sys.version_info: "A tuple containing the five components of
69 # the version number: major, minor, micro, releaselevel, and serial. All

Subscribers

People subscribed via source and target branches