1 =========================
2 Contributing to testtools
3 =========================
8 In general, follow `PEP 8`_ except where consistency with the standard
9 library's unittest_ module would suggest otherwise.
11 testtools supports Python 2.4 and later, including Python 3, so avoid any
12 2.5-only features like the ``with`` statement.
18 Part of testtools raison d'etre is to provide Python with improvements to the
19 testing code it ships. For that reason we require all contributions (that are
20 non-trivial) to meet one of the following rules:
22 * be inapplicable for inclusion in Python.
23 * be able to be included in Python without further contact with the contributor.
24 * be copyright assigned to Jonathan M. Lange.
26 Please pick one of these and specify it when contributing code to testtools.
32 All code that is not copyright assigned to Jonathan M. Lange (see Copyright
33 Assignment above) needs to be licensed under the `MIT license`_ that testtools
34 uses, so that testtools can ship it.
40 Please write tests for every feature. This project ought to be a model
41 example of well-tested Python code!
43 Take particular care to make sure the *intent* of each test is clear.
45 You can run tests with ``make check``.
47 By default, testtools hides many levels of its own stack when running tests.
48 This is for the convenience of users, who do not care about how, say, assert
49 methods are implemented. However, when writing tests for testtools itself, it
50 is often useful to see all levels of the stack. To do this, add
51 ``run_tests_with = FullStackRunTest`` to the top of a test's class definition.
57 Documents are written using the Sphinx_ variant of reStructuredText_. All
58 public methods, functions, classes and modules must have API documentation.
59 When changing code, be sure to check the API documentation to see if it could
60 be improved. Before submitting changes to trunk, look over them and see if
61 the manuals ought to be updated.
67 The top-level directory contains the ``testtools/`` package directory, and
68 miscellaneous files like ``README`` and ``setup.py``.
70 The ``testtools/`` directory is the Python package itself. It is separated
71 into submodules for internal clarity, but all public APIs should be “promoted”
72 into the top-level package by importing them in ``testtools/__init__.py``.
73 Users of testtools should never import a submodule in order to use a stable
74 API. Unstable APIs like ``testtools.matchers`` and
75 ``testtools.deferredruntest`` should be exported as submodules.
77 Tests belong in ``testtools/tests/``.
83 Testtools is maintained using bzr, with its trunk at lp:testtools. This gives
84 every contributor the ability to commit their work to their own branches.
85 However permission must be granted to allow contributors to commit to the trunk
88 Commit access to trunk is obtained by joining the testtools-committers
89 Launchpad team. Membership in this team is contingent on obeying the testtools
90 contribution policy, see `Copyright Assignment`_ above.
96 All code must be reviewed before landing on trunk. The process is to create a
97 branch in launchpad, and submit it for merging to lp:testtools. It will then
98 be reviewed before it can be merged to trunk. It will be reviewed by someone:
101 * a committer (member of the `~testtools-committers`_ team)
103 As a special exception, while the testtools committers team is small and prone
104 to blocking, a merge request from a committer that has not been reviewed after
105 24 hours may be merged by that committer. When the team is larger this policy
108 Code reviewers should look for the quality of what is being submitted,
109 including conformance with this HACKING file.
111 Changes which all users should be made aware of should be documented in NEWS.
117 The file NEWS is structured as a sorted list of releases. Each release can have
118 a free form description and more or more sections with bullet point items.
119 Sections in use today are 'Improvements' and 'Changes'. To ease merging between
120 branches, the bullet points are kept alphabetically sorted. The release NEXT is
121 permanently present at the top of the list.
127 #. Choose a version number, say X.Y.Z
128 #. Branch from trunk to testtools-X.Y.Z
129 #. In testtools-X.Y.Z, ensure __init__ has version ``(X, Y, Z, 'final', 0)``
130 #. Replace NEXT in NEWS with the version number X.Y.Z, adjusting the reST.
131 #. Possibly write a blurb into NEWS.
132 #. Replace any additional references to NEXT with the version being
133 released. (There should be none other than the ones in these release tasks
134 which should not be replaced).
135 #. Commit the changes.
136 #. Tag the release, bzr tag testtools-X.Y.Z
137 #. Run 'make release', this:
138 #. Creates a source distribution and uploads to PyPI
139 #. Ensures all Fix Committed bugs are in the release milestone
140 #. Makes a release on Launchpad and uploads the tarball
141 #. Marks all the Fix Committed bugs as Fix Released
142 #. Creates a new milestone
143 #. Merge the release branch testtools-X.Y.Z into trunk. Before the commit,
144 add a NEXT heading to the top of NEWS and bump the version in __init__.py.
145 Push trunk to Launchpad
146 #. If a new series has been created (e.g. 0.10.0), make the series on Launchpad.
148 .. _PEP 8: http://www.python.org/dev/peps/pep-0008/
149 .. _unittest: http://docs.python.org/library/unittest.html
150 .. _~testtools-committers: https://launchpad.net/~testtools-committers
151 .. _MIT license: http://www.opensource.org/licenses/mit-license.php
152 .. _Sphinx: http://sphinx.pocoo.org/
153 .. _restructuredtext: http://docutils.sourceforge.net/rst.html