Merge lp:~jml/testtools/docs-update into lp:~testtools-committers/testtools/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 225
Proposed branch: lp:~jml/testtools/docs-update
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 47 lines (+27/-0)
2 files modified
NEWS (+2/-0)
doc/for-framework-folk.rst (+25/-0)
To merge this branch: bzr merge lp:~jml/testtools/docs-update
Reviewer Review Type Date Requested Status
testtools committers Pending
Review via email: mp+70868@code.launchpad.net

Description of the change

Adds docs for two things that people might not otherwise find: ErrorHolder and PlaceHolder.

To post a comment you must log in.
lp:~jml/testtools/docs-update updated
223. By Jonathan Lange

Merge trunk. Resolve conflicts.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2011-08-08 11:16:01 +0000
3+++ NEWS 2011-08-09 13:15:20 +0000
4@@ -43,6 +43,8 @@
5 * ``DocTestMatches`` correctly handles unicode output from examples, rather
6 than raising an error. (Martin [gz], #764170)
7
8+* ``ErrorHolder`` and ``PlaceHolder`` added to docs. (Jonathan Lange, #816597)
9+
10 * ``ExpectedException`` now matches any exception of the given type by
11 default, and also allows specifying a ``Matcher`` rather than a mere regular
12 expression. (Jonathan Lange, #791889)
13
14=== modified file 'doc/for-framework-folk.rst'
15--- doc/for-framework-folk.rst 2011-07-20 12:53:13 +0000
16+++ doc/for-framework-folk.rst 2011-08-09 13:15:20 +0000
17@@ -79,6 +79,31 @@
18 parameterization.
19
20
21+Test placeholders
22+=================
23+
24+Sometimes, it's useful to be able to add things to a test suite that are not
25+actually tests. For example, you might wish to represents import failures
26+that occur during test discovery as tests, so that your test result object
27+doesn't have to do special work to handle them nicely.
28+
29+testtools provides two such objects, called "placeholders": ``PlaceHolder``
30+and ``ErrorHolder``. ``PlaceHolder`` takes a test id and an optional
31+description. When it's run, it succeeds. ``ErrorHolder`` takes a test id,
32+and error and an optional short description. When it's run, it reports that
33+error.
34+
35+These placeholders are best used to log events that occur outside the test
36+suite proper, but are still very relevant to its results.
37+
38+e.g.::
39+
40+ >>> suite = TestSuite()
41+ >>> suite.add(PlaceHolder('I record an event'))
42+ >>> suite.run(TextTestResult(verbose=True))
43+ I record an event [OK]
44+
45+
46 Extensions to TestResult
47 ========================
48

Subscribers

People subscribed via source and target branches