testtools: Fix included testtools, for systems that don't have it.
[nivanova/samba-autobuild/.git] / lib / testtools / NEWS
1 testtools NEWS
2 ++++++++++++++
3
4 NEXT
5 ~~~~
6
7 Improvements
8 ------------
9
10 * New matcher "Annotate" that adds a simple string message to another matcher,
11   much like the option 'message' parameter to standard library assertFoo
12   methods.
13
14 * New matchers "Not" and "MatchesAll". "Not" will invert another matcher, and
15   "MatchesAll" that needs a successful match for all of its arguments.
16
17 * On Python 2.4, where types.FunctionType cannot be deepcopied, testtools will
18   now monkeypatch copy._deepcopy_dispatch using the same trivial patch that
19   added such support to Python 2.5. The monkey patch is triggered by the
20   absence of FunctionType from the dispatch dict rather than a version check.
21   Bug #498030.
22
23 * On windows the test 'test_now_datetime_now' should now work reliably.
24
25 * TestCase.getUniqueInteger and TestCase.getUniqueString now have docstrings.
26
27 * TestCase.getUniqueString now takes an optional prefix parameter, so you can
28   now use it in circumstances that forbid strings with '.'s, and such like.
29
30 * testtools.testcase.clone_test_with_new_id now uses copy.copy, rather than
31   copy.deepcopy. Tests that need a deeper copy should use the copy protocol to
32   control how they are copied. Bug #498869.
33
34 * The backtrace test result output tests should now pass on windows and other
35   systems where os.sep is not '/'.
36
37
38 0.9.2
39 ~~~~~
40
41 Python 3 support, more matchers and better consistency with Python 2.7 --
42 you'd think that would be enough for a point release. Well, we here on the
43 testtools project think that you deserve more.
44
45 We've added a hook so that user code can be called just-in-time whenever there
46 is an exception, and we've also factored out the "run" logic of test cases so
47 that new outcomes can be added without fiddling with the actual flow of logic.
48
49 It might sound like small potatoes, but it's changes like these that will
50 bring about the end of test frameworks.
51
52
53 Improvements
54 ------------
55
56 * A failure in setUp and tearDown now report as failures not as errors.
57
58 * Cleanups now run after tearDown to be consistent with Python 2.7's cleanup
59   feature.
60
61 * ExtendedToOriginalDecorator now passes unrecognised attributes through
62   to the decorated result object, permitting other extensions to the
63   TestCase -> TestResult protocol to work.
64
65 * It is now possible to trigger code just-in-time after an exception causes
66   a test outcome such as failure or skip. See the testtools MANUAL or
67   ``pydoc testtools.TestCase.addOnException``. (bug #469092)
68
69 * New matcher Equals which performs a simple equality test.
70
71 * New matcher MatchesAny which looks for a match of any of its arguments.
72
73 * TestCase no longer breaks if a TestSkipped exception is raised with no
74   parameters.
75
76 * TestCase.run now clones test cases before they are run and runs the clone.
77   This reduces memory footprint in large test runs - state accumulated on
78   test objects during their setup and execution gets freed when test case
79   has finished running unless the TestResult object keeps a reference.
80   NOTE: As test cloning uses deepcopy, this can potentially interfere if
81   a test suite has shared state (such as the testscenarios or testresources
82   projects use).  Use the __deepcopy__ hook to control the copying of such
83   objects so that the shared references stay shared.
84
85 * Testtools now accepts contributions without copyright assignment under some
86   circumstances. See HACKING for details.
87
88 * Testtools now provides a convenient way to run a test suite using the
89   testtools result object: python -m testtools.run testspec [testspec...].
90
91 * Testtools now works on Python 3, thanks to Benjamin Peterson.
92
93 * Test execution now uses a separate class, testtools.RunTest to run single
94   tests. This can be customised and extended in a more consistent fashion than
95   the previous run method idiom. See pydoc for more information.
96
97 * The test doubles that testtools itself uses are now available as part of
98   the testtools API in testtols.testresult.doubles.
99
100 * TracebackContent now sets utf8 as the charset encoding, rather than not
101   setting one and encoding with the default encoder.
102
103 * With python2.7 testtools.TestSkipped will be the unittest.case.SkipTest
104   exception class making skips compatible with code that manually raises the
105   standard library exception. (bug #490109)
106
107 Changes
108 -------
109
110 * TestCase.getUniqueInteger is now implemented using itertools.count. Thanks
111   to Benjamin Peterson for the patch. (bug #490111)
112
113
114 0.9.1
115 ~~~~~
116
117 The new matcher API introduced in 0.9.0 had a small flaw where the matchee
118 would be evaluated twice to get a description of the mismatch. This could lead
119 to bugs if the act of matching caused side effects to occur in the matchee.
120 Since having such side effects isn't desirable, we have changed the API now
121 before it has become widespread.
122
123 Changes
124 -------
125
126 * Matcher API changed to avoid evaluating matchee twice. Please consult
127   the API documentation.
128
129 * TestCase.getUniqueString now uses the test id, not the test method name,
130   which works nicer with parameterised tests.
131
132 Improvements
133 ------------
134
135 * Python2.4 is now supported again.
136
137
138 0.9.0
139 ~~~~~
140
141 This release of testtools is perhaps the most interesting and exciting one
142 it's ever had. We've continued in bringing together the best practices of unit
143 testing from across a raft of different Python projects, but we've also
144 extended our mission to incorporating unit testing concepts from other
145 languages and from our own research, led by Robert Collins.
146
147 We now support skipping and expected failures. We'll make sure that you
148 up-call setUp and tearDown, avoiding unexpected testing weirdnesses. We're
149 now compatible with Python 2.5, 2.6 and 2.7 unittest library.
150
151 All in all, if you are serious about unit testing and want to get the best
152 thinking from the whole Python community, you should get this release.
153
154 Improvements
155 ------------
156
157 * A new TestResult API has been added for attaching details to test outcomes.
158   This API is currently experimental, but is being prepared with the intent
159   of becoming an upstream Python API. For more details see pydoc
160   testtools.TestResult and the TestCase addDetail / getDetails methods.
161
162 * assertThat has been added to TestCase. This new assertion supports
163   a hamcrest-inspired matching protocol. See pydoc testtools.Matcher for
164   details about writing matchers, and testtools.matchers for the included
165   matchers. See http://code.google.com/p/hamcrest/.
166
167 * Compatible with Python 2.6 and Python 2.7
168
169 * Failing to upcall in setUp or tearDown will now cause a test failure.
170   While the base methods do nothing, failing to upcall is usually a problem
171   in deeper hierarchies, and checking that the root method is called is a
172   simple way to catch this common bug.
173
174 * New TestResult decorator ExtendedToOriginalDecorator which handles
175   downgrading extended API calls like addSkip to older result objects that
176   do not support them. This is used internally to make testtools simpler but
177   can also be used to simplify other code built on or for use with testtools.
178
179 * New TextTestResult supporting the extended APIs that testtools provides.
180
181 * Nose will no longer find 'runTest' tests in classes derived from
182    testtools.testcase.TestCase (bug #312257).
183
184 * Supports the Python 2.7/3.1 addUnexpectedSuccess and addExpectedFailure
185   TestResult methods, with a support function 'knownFailure' to let tests
186   trigger these outcomes.
187
188 * When using the skip feature with TestResult objects that do not support it
189   a test success will now be reported. Previously an error was reported but
190   production experience has shown that this is too disruptive for projects that
191   are using skips: they cannot get a clean run on down-level result objects.