testtools: Import new upstream snapshot.
[nivanova/samba-autobuild/.git] / lib / testtools / NEWS
1 testtools NEWS
2 ++++++++++++++
3
4 NEXT
5 ~~~~
6
7 Improvements
8 ------------
9
10 * Cleanups can raise ``testtools.MultipleExceptions`` if they have multiple
11   exceptions to report. For instance, a cleanup which is itself responsible for
12   running several different internal cleanup routines might use this.
13
14 * Code duplication between assertEqual and the matcher Equals has been removed.
15
16 * In normal circumstances, a TestCase will no longer share details with clones
17   of itself. (Andrew Bennetts, bug #637725)
18
19
20 0.9.6
21 ~~~~~
22
23 Nothing major in this release, just enough small bits and pieces to make it
24 useful enough to upgrade to.
25
26 In particular, a serious bug in assertThat() has been fixed, it's easier to
27 write Matchers, there's a TestCase.patch() method for those inevitable monkey
28 patches and TestCase.assertEqual gives slightly nicer errors.
29
30 Improvements
31 ------------
32
33 * 'TestCase.assertEqual' now formats errors a little more nicely, in the
34   style of bzrlib.
35
36 * Added `PlaceHolder` and `ErrorHolder`, TestCase-like objects that can be
37   used to add results to a `TestResult`.
38
39 * 'Mismatch' now takes optional description and details parameters, so
40   custom Matchers aren't compelled to make their own subclass.
41
42 * jml added a built-in UTF8_TEXT ContentType to make it slightly easier to
43   add details to test results. See bug #520044.
44
45 * Fix a bug in our built-in matchers where assertThat would blow up if any
46   of them failed. All built-in mismatch objects now provide get_details().
47
48 * New 'Is' matcher, which lets you assert that a thing is identical to
49   another thing.
50
51 * New 'LessThan' matcher which lets you assert that a thing is less than
52   another thing.
53
54 * TestCase now has a 'patch()' method to make it easier to monkey-patching
55   objects in tests. See the manual for more information. Fixes bug #310770.
56
57 * MultiTestResult methods now pass back return values from the results it
58   forwards to.
59
60 0.9.5
61 ~~~~~
62
63 This release fixes some obscure traceback formatting issues that probably
64 weren't affecting you but were certainly breaking our own test suite.
65
66 Changes
67 -------
68
69 * Jamu Kakar has updated classes in testtools.matchers and testtools.runtest
70   to be new-style classes, fixing bug #611273.
71
72 Improvements
73 ------------
74
75 * Martin[gz] fixed traceback handling to handle cases where extract_tb returns
76   a source line of None. Fixes bug #611307.
77
78 * Martin[gz] fixed an unicode issue that was causing the tests to fail,
79   closing bug #604187.
80
81 * testtools now handles string exceptions (although why would you want to use
82   them?) and formats their tracebacks correctly. Thanks to Martin[gz] for
83   fixing bug #592262.
84
85 0.9.4
86 ~~~~~
87
88 This release overhauls the traceback formatting layer to deal with Python 2
89 line numbers and traceback objects often being local user encoded strings
90 rather than unicode objects. Test discovery has also been added and Python 3.1
91 is also supported. Finally, the Mismatch protocol has been extended to let
92 Matchers collaborate with tests in supplying detailed data about failures.
93
94 Changes
95 -------
96
97 * testtools.utils has been renamed to testtools.compat. Importing
98   testtools.utils will now generate a deprecation warning.
99
100 Improvements
101 ------------
102
103 * Add machinery for Python 2 to create unicode tracebacks like those used by
104   Python 3. This means testtools no longer throws on encountering non-ascii
105   filenames, source lines, or exception strings when displaying test results.
106   Largely contributed by Martin[gz] with some tweaks from Robert Collins.
107
108 * James Westby has supplied test discovery support using the Python 2.7
109   TestRunner in testtools.run. This requires the 'discover' module. This
110   closes bug #250764.
111
112 * Python 3.1 is now supported, thanks to Martin[gz] for a partial patch.
113   This fixes bug #592375.
114
115 * TestCase.addCleanup has had its docstring corrected about when cleanups run.
116
117 * TestCase.skip is now deprecated in favour of TestCase.skipTest, which is the
118   Python2.7 spelling for skip. This closes bug #560436.
119
120 * Tests work on IronPython patch from Martin[gz] applied.
121
122 * Thanks to a patch from James Westby testtools.matchers.Mismatch can now
123   supply a get_details method, which assertThat will query to provide
124   additional attachments. This can be used to provide additional detail
125   about the mismatch that doesn't suite being included in describe(). For
126   instance, if the match process was complex, a log of the process could be
127   included, permitting debugging.
128
129 * testtools.testresults.real._StringException will now answer __str__ if its
130   value is unicode by encoding with UTF8, and vice versa to answer __unicode__.
131   This permits subunit decoded exceptions to contain unicode and still format
132   correctly.
133
134 0.9.3
135 ~~~~~
136
137 More matchers, Python 2.4 support, faster test cloning by switching to copy
138 rather than deepcopy and better output when exceptions occur in cleanups are
139 the defining characteristics of this release.
140
141 Improvements
142 ------------
143
144 * New matcher "Annotate" that adds a simple string message to another matcher,
145   much like the option 'message' parameter to standard library assertFoo
146   methods.
147
148 * New matchers "Not" and "MatchesAll". "Not" will invert another matcher, and
149   "MatchesAll" that needs a successful match for all of its arguments.
150
151 * On Python 2.4, where types.FunctionType cannot be deepcopied, testtools will
152   now monkeypatch copy._deepcopy_dispatch using the same trivial patch that
153   added such support to Python 2.5. The monkey patch is triggered by the
154   absence of FunctionType from the dispatch dict rather than a version check.
155   Bug #498030.
156
157 * On windows the test 'test_now_datetime_now' should now work reliably.
158
159 * TestCase.getUniqueInteger and TestCase.getUniqueString now have docstrings.
160
161 * TestCase.getUniqueString now takes an optional prefix parameter, so you can
162   now use it in circumstances that forbid strings with '.'s, and such like.
163
164 * testtools.testcase.clone_test_with_new_id now uses copy.copy, rather than
165   copy.deepcopy. Tests that need a deeper copy should use the copy protocol to
166   control how they are copied. Bug #498869.
167
168 * The backtrace test result output tests should now pass on windows and other
169   systems where os.sep is not '/'.
170
171 * When a cleanUp or tearDown exception occurs, it is now accumulated as a new
172   traceback in the test details, rather than as a separate call to addError / 
173   addException. This makes testtools work better with most TestResult objects
174   and fixes bug #335816.
175
176
177 0.9.2
178 ~~~~~
179
180 Python 3 support, more matchers and better consistency with Python 2.7 --
181 you'd think that would be enough for a point release. Well, we here on the
182 testtools project think that you deserve more.
183
184 We've added a hook so that user code can be called just-in-time whenever there
185 is an exception, and we've also factored out the "run" logic of test cases so
186 that new outcomes can be added without fiddling with the actual flow of logic.
187
188 It might sound like small potatoes, but it's changes like these that will
189 bring about the end of test frameworks.
190
191
192 Improvements
193 ------------
194
195 * A failure in setUp and tearDown now report as failures not as errors.
196
197 * Cleanups now run after tearDown to be consistent with Python 2.7's cleanup
198   feature.
199
200 * ExtendedToOriginalDecorator now passes unrecognised attributes through
201   to the decorated result object, permitting other extensions to the
202   TestCase -> TestResult protocol to work.
203
204 * It is now possible to trigger code just-in-time after an exception causes
205   a test outcome such as failure or skip. See the testtools MANUAL or
206   ``pydoc testtools.TestCase.addOnException``. (bug #469092)
207
208 * New matcher Equals which performs a simple equality test.
209
210 * New matcher MatchesAny which looks for a match of any of its arguments.
211
212 * TestCase no longer breaks if a TestSkipped exception is raised with no
213   parameters.
214
215 * TestCase.run now clones test cases before they are run and runs the clone.
216   This reduces memory footprint in large test runs - state accumulated on
217   test objects during their setup and execution gets freed when test case
218   has finished running unless the TestResult object keeps a reference.
219   NOTE: As test cloning uses deepcopy, this can potentially interfere if
220   a test suite has shared state (such as the testscenarios or testresources
221   projects use).  Use the __deepcopy__ hook to control the copying of such
222   objects so that the shared references stay shared.
223
224 * Testtools now accepts contributions without copyright assignment under some
225   circumstances. See HACKING for details.
226
227 * Testtools now provides a convenient way to run a test suite using the
228   testtools result object: python -m testtools.run testspec [testspec...].
229
230 * Testtools now works on Python 3, thanks to Benjamin Peterson.
231
232 * Test execution now uses a separate class, testtools.RunTest to run single
233   tests. This can be customised and extended in a more consistent fashion than
234   the previous run method idiom. See pydoc for more information.
235
236 * The test doubles that testtools itself uses are now available as part of
237   the testtools API in testtols.testresult.doubles.
238
239 * TracebackContent now sets utf8 as the charset encoding, rather than not
240   setting one and encoding with the default encoder.
241
242 * With python2.7 testtools.TestSkipped will be the unittest.case.SkipTest
243   exception class making skips compatible with code that manually raises the
244   standard library exception. (bug #490109)
245
246 Changes
247 -------
248
249 * TestCase.getUniqueInteger is now implemented using itertools.count. Thanks
250   to Benjamin Peterson for the patch. (bug #490111)
251
252
253 0.9.1
254 ~~~~~
255
256 The new matcher API introduced in 0.9.0 had a small flaw where the matchee
257 would be evaluated twice to get a description of the mismatch. This could lead
258 to bugs if the act of matching caused side effects to occur in the matchee.
259 Since having such side effects isn't desirable, we have changed the API now
260 before it has become widespread.
261
262 Changes
263 -------
264
265 * Matcher API changed to avoid evaluating matchee twice. Please consult
266   the API documentation.
267
268 * TestCase.getUniqueString now uses the test id, not the test method name,
269   which works nicer with parameterised tests.
270
271 Improvements
272 ------------
273
274 * Python2.4 is now supported again.
275
276
277 0.9.0
278 ~~~~~
279
280 This release of testtools is perhaps the most interesting and exciting one
281 it's ever had. We've continued in bringing together the best practices of unit
282 testing from across a raft of different Python projects, but we've also
283 extended our mission to incorporating unit testing concepts from other
284 languages and from our own research, led by Robert Collins.
285
286 We now support skipping and expected failures. We'll make sure that you
287 up-call setUp and tearDown, avoiding unexpected testing weirdnesses. We're
288 now compatible with Python 2.5, 2.6 and 2.7 unittest library.
289
290 All in all, if you are serious about unit testing and want to get the best
291 thinking from the whole Python community, you should get this release.
292
293 Improvements
294 ------------
295
296 * A new TestResult API has been added for attaching details to test outcomes.
297   This API is currently experimental, but is being prepared with the intent
298   of becoming an upstream Python API. For more details see pydoc
299   testtools.TestResult and the TestCase addDetail / getDetails methods.
300
301 * assertThat has been added to TestCase. This new assertion supports
302   a hamcrest-inspired matching protocol. See pydoc testtools.Matcher for
303   details about writing matchers, and testtools.matchers for the included
304   matchers. See http://code.google.com/p/hamcrest/.
305
306 * Compatible with Python 2.6 and Python 2.7
307
308 * Failing to upcall in setUp or tearDown will now cause a test failure.
309   While the base methods do nothing, failing to upcall is usually a problem
310   in deeper hierarchies, and checking that the root method is called is a
311   simple way to catch this common bug.
312
313 * New TestResult decorator ExtendedToOriginalDecorator which handles
314   downgrading extended API calls like addSkip to older result objects that
315   do not support them. This is used internally to make testtools simpler but
316   can also be used to simplify other code built on or for use with testtools.
317
318 * New TextTestResult supporting the extended APIs that testtools provides.
319
320 * Nose will no longer find 'runTest' tests in classes derived from
321    testtools.testcase.TestCase (bug #312257).
322
323 * Supports the Python 2.7/3.1 addUnexpectedSuccess and addExpectedFailure
324   TestResult methods, with a support function 'knownFailure' to let tests
325   trigger these outcomes.
326
327 * When using the skip feature with TestResult objects that do not support it
328   a test success will now be reported. Previously an error was reported but
329   production experience has shown that this is too disruptive for projects that
330   are using skips: they cannot get a clean run on down-level result objects.