source: trunk/server/lib/testtools/NEWS@ 888

Last change on this file since 888 was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 18.2 KB
Line 
1testtools NEWS
2++++++++++++++
3
4NEXT
5~~~~
6
7Changes
8-------
9
10* The timestamps generated by ``TestResult`` objects when no timing data has
11 been received are now datetime-with-timezone, which allows them to be
12 sensibly serialised and transported. (Robert Collins, #692297)
13
14Improvements
15------------
16
17* ``MultiTestResult`` now forwards the ``time`` API. (Robert Collins, #692294)
18
190.9.8
20~~~~~
21
22In this release we bring some very interesting improvements:
23
24* new matchers for exceptions, sets, lists, dicts and more.
25
26* experimental (works but the contract isn't supported) twisted reactor
27 support.
28
29* The built in runner can now list tests and filter tests (the -l and
30 --load-list options).
31
32Changes
33-------
34
35* addUnexpectedSuccess is translated to addFailure for test results that don't
36 know about addUnexpectedSuccess. Further, it fails the entire result for
37 all testtools TestResults (i.e. wasSuccessful() returns False after
38 addUnexpectedSuccess has been called). Note that when using a delegating
39 result such as ThreadsafeForwardingResult, MultiTestResult or
40 ExtendedToOriginalDecorator then the behaviour of addUnexpectedSuccess is
41 determined by the delegated to result(s).
42 (Jonathan Lange, Robert Collins, #654474, #683332)
43
44* startTestRun will reset any errors on the result. That is, wasSuccessful()
45 will always return True immediately after startTestRun() is called. This
46 only applies to delegated test results (ThreadsafeForwardingResult,
47 MultiTestResult and ExtendedToOriginalDecorator) if the delegated to result
48 is a testtools test result - we cannot reliably reset the state of unknown
49 test result class instances. (Jonathan Lange, Robert Collins, #683332)
50
51* Responsibility for running test cleanups has been moved to ``RunTest``.
52 This change does not affect public APIs and can be safely ignored by test
53 authors. (Jonathan Lange, #662647)
54
55Improvements
56------------
57
58* ``assertIsInstance`` supports a custom error message to be supplied, which
59 is necessary when using ``assertDictEqual`` on Python 2.7 with a
60 ``testtools.TestCase`` base class. (Jelmer Vernooij)
61
62* Experimental support for running tests that return Deferreds.
63 (Jonathan Lange, Martin [gz])
64
65* Provide a per-test decorator, run_test_with, to specify which RunTest
66 object to use for a given test. (Jonathan Lange, #657780)
67
68* Fix the runTest parameter of TestCase to actually work, rather than raising
69 a TypeError. (Jonathan Lange, #657760)
70
71* New matcher ``EndsWith`` added to complement the existing ``StartsWith``
72 matcher. (Jonathan Lange, #669165)
73
74* Non-release snapshots of testtools will now work with buildout.
75 (Jonathan Lange, #613734)
76
77* Malformed SyntaxErrors no longer blow up the test suite. (Martin [gz])
78
79* ``MatchesException`` added to the ``testtools.matchers`` module - matches
80 an exception class and parameters. (Robert Collins)
81
82* ``MismatchesAll.describe`` no longer appends a trailing newline.
83 (Michael Hudson-Doyle, #686790)
84
85* New ``KeysEqual`` matcher. (Jonathan Lange)
86
87* New helpers for conditionally importing modules, ``try_import`` and
88 ``try_imports``. (Jonathan Lange)
89
90* ``Raises`` added to the ``testtools.matchers`` module - matches if the
91 supplied callable raises, and delegates to an optional matcher for validation
92 of the exception. (Robert Collins)
93
94* ``raises`` added to the ``testtools.matchers`` module - matches if the
95 supplied callable raises and delegates to ``MatchesException`` to validate
96 the exception. (Jonathan Lange)
97
98* Tests will now pass on Python 2.6.4 : an ``Exception`` change made only in
99 2.6.4 and reverted in Python 2.6.5 was causing test failures on that version.
100 (Martin [gz], #689858).
101
102* ``testtools.TestCase.useFixture`` has been added to glue with fixtures nicely.
103 (Robert Collins)
104
105* ``testtools.run`` now supports ``-l`` to list tests rather than executing
106 them. This is useful for integration with external test analysis/processing
107 tools like subunit and testrepository. (Robert Collins)
108
109* ``testtools.run`` now supports ``--load-list``, which takes a file containing
110 test ids, one per line, and intersects those ids with the tests found. This
111 allows fine grained control of what tests are run even when the tests cannot
112 be named as objects to import (e.g. due to test parameterisation via
113 testscenarios). (Robert Collins)
114
115* Update documentation to say how to use testtools.run() on Python 2.4.
116 (Jonathan Lange, #501174)
117
118* ``text_content`` conveniently converts a Python string to a Content object.
119 (Jonathan Lange, James Westby)
120
121
122
1230.9.7
124~~~~~
125
126Lots of little cleanups in this release; many small improvements to make your
127testing life more pleasant.
128
129Improvements
130------------
131
132* Cleanups can raise ``testtools.MultipleExceptions`` if they have multiple
133 exceptions to report. For instance, a cleanup which is itself responsible for
134 running several different internal cleanup routines might use this.
135
136* Code duplication between assertEqual and the matcher Equals has been removed.
137
138* In normal circumstances, a TestCase will no longer share details with clones
139 of itself. (Andrew Bennetts, bug #637725)
140
141* Less exception object cycles are generated (reduces peak memory use between
142 garbage collection). (Martin [gz])
143
144* New matchers 'DoesNotStartWith' and 'StartsWith' contributed by Canonical
145 from the Launchpad project. Written by James Westby.
146
147* Timestamps as produced by subunit protocol clients are now forwarded in the
148 ThreadsafeForwardingResult so correct test durations can be reported.
149 (Martin [gz], Robert Collins, #625594)
150
151* With unittest from Python 2.7 skipped tests will now show only the reason
152 rather than a serialisation of all details. (Martin [gz], #625583)
153
154* The testtools release process is now a little better documented and a little
155 smoother. (Jonathan Lange, #623483, #623487)
156
157
1580.9.6
159~~~~~
160
161Nothing major in this release, just enough small bits and pieces to make it
162useful enough to upgrade to.
163
164In particular, a serious bug in assertThat() has been fixed, it's easier to
165write Matchers, there's a TestCase.patch() method for those inevitable monkey
166patches and TestCase.assertEqual gives slightly nicer errors.
167
168Improvements
169------------
170
171* 'TestCase.assertEqual' now formats errors a little more nicely, in the
172 style of bzrlib.
173
174* Added `PlaceHolder` and `ErrorHolder`, TestCase-like objects that can be
175 used to add results to a `TestResult`.
176
177* 'Mismatch' now takes optional description and details parameters, so
178 custom Matchers aren't compelled to make their own subclass.
179
180* jml added a built-in UTF8_TEXT ContentType to make it slightly easier to
181 add details to test results. See bug #520044.
182
183* Fix a bug in our built-in matchers where assertThat would blow up if any
184 of them failed. All built-in mismatch objects now provide get_details().
185
186* New 'Is' matcher, which lets you assert that a thing is identical to
187 another thing.
188
189* New 'LessThan' matcher which lets you assert that a thing is less than
190 another thing.
191
192* TestCase now has a 'patch()' method to make it easier to monkey-patching
193 objects in tests. See the manual for more information. Fixes bug #310770.
194
195* MultiTestResult methods now pass back return values from the results it
196 forwards to.
197
1980.9.5
199~~~~~
200
201This release fixes some obscure traceback formatting issues that probably
202weren't affecting you but were certainly breaking our own test suite.
203
204Changes
205-------
206
207* Jamu Kakar has updated classes in testtools.matchers and testtools.runtest
208 to be new-style classes, fixing bug #611273.
209
210Improvements
211------------
212
213* Martin[gz] fixed traceback handling to handle cases where extract_tb returns
214 a source line of None. Fixes bug #611307.
215
216* Martin[gz] fixed an unicode issue that was causing the tests to fail,
217 closing bug #604187.
218
219* testtools now handles string exceptions (although why would you want to use
220 them?) and formats their tracebacks correctly. Thanks to Martin[gz] for
221 fixing bug #592262.
222
2230.9.4
224~~~~~
225
226This release overhauls the traceback formatting layer to deal with Python 2
227line numbers and traceback objects often being local user encoded strings
228rather than unicode objects. Test discovery has also been added and Python 3.1
229is also supported. Finally, the Mismatch protocol has been extended to let
230Matchers collaborate with tests in supplying detailed data about failures.
231
232Changes
233-------
234
235* testtools.utils has been renamed to testtools.compat. Importing
236 testtools.utils will now generate a deprecation warning.
237
238Improvements
239------------
240
241* Add machinery for Python 2 to create unicode tracebacks like those used by
242 Python 3. This means testtools no longer throws on encountering non-ascii
243 filenames, source lines, or exception strings when displaying test results.
244 Largely contributed by Martin[gz] with some tweaks from Robert Collins.
245
246* James Westby has supplied test discovery support using the Python 2.7
247 TestRunner in testtools.run. This requires the 'discover' module. This
248 closes bug #250764.
249
250* Python 3.1 is now supported, thanks to Martin[gz] for a partial patch.
251 This fixes bug #592375.
252
253* TestCase.addCleanup has had its docstring corrected about when cleanups run.
254
255* TestCase.skip is now deprecated in favour of TestCase.skipTest, which is the
256 Python2.7 spelling for skip. This closes bug #560436.
257
258* Tests work on IronPython patch from Martin[gz] applied.
259
260* Thanks to a patch from James Westby testtools.matchers.Mismatch can now
261 supply a get_details method, which assertThat will query to provide
262 additional attachments. This can be used to provide additional detail
263 about the mismatch that doesn't suite being included in describe(). For
264 instance, if the match process was complex, a log of the process could be
265 included, permitting debugging.
266
267* testtools.testresults.real._StringException will now answer __str__ if its
268 value is unicode by encoding with UTF8, and vice versa to answer __unicode__.
269 This permits subunit decoded exceptions to contain unicode and still format
270 correctly.
271
2720.9.3
273~~~~~
274
275More matchers, Python 2.4 support, faster test cloning by switching to copy
276rather than deepcopy and better output when exceptions occur in cleanups are
277the defining characteristics of this release.
278
279Improvements
280------------
281
282* New matcher "Annotate" that adds a simple string message to another matcher,
283 much like the option 'message' parameter to standard library assertFoo
284 methods.
285
286* New matchers "Not" and "MatchesAll". "Not" will invert another matcher, and
287 "MatchesAll" that needs a successful match for all of its arguments.
288
289* On Python 2.4, where types.FunctionType cannot be deepcopied, testtools will
290 now monkeypatch copy._deepcopy_dispatch using the same trivial patch that
291 added such support to Python 2.5. The monkey patch is triggered by the
292 absence of FunctionType from the dispatch dict rather than a version check.
293 Bug #498030.
294
295* On windows the test 'test_now_datetime_now' should now work reliably.
296
297* TestCase.getUniqueInteger and TestCase.getUniqueString now have docstrings.
298
299* TestCase.getUniqueString now takes an optional prefix parameter, so you can
300 now use it in circumstances that forbid strings with '.'s, and such like.
301
302* testtools.testcase.clone_test_with_new_id now uses copy.copy, rather than
303 copy.deepcopy. Tests that need a deeper copy should use the copy protocol to
304 control how they are copied. Bug #498869.
305
306* The backtrace test result output tests should now pass on windows and other
307 systems where os.sep is not '/'.
308
309* When a cleanUp or tearDown exception occurs, it is now accumulated as a new
310 traceback in the test details, rather than as a separate call to addError /
311 addException. This makes testtools work better with most TestResult objects
312 and fixes bug #335816.
313
314
3150.9.2
316~~~~~
317
318Python 3 support, more matchers and better consistency with Python 2.7 --
319you'd think that would be enough for a point release. Well, we here on the
320testtools project think that you deserve more.
321
322We've added a hook so that user code can be called just-in-time whenever there
323is an exception, and we've also factored out the "run" logic of test cases so
324that new outcomes can be added without fiddling with the actual flow of logic.
325
326It might sound like small potatoes, but it's changes like these that will
327bring about the end of test frameworks.
328
329
330Improvements
331------------
332
333* A failure in setUp and tearDown now report as failures not as errors.
334
335* Cleanups now run after tearDown to be consistent with Python 2.7's cleanup
336 feature.
337
338* ExtendedToOriginalDecorator now passes unrecognised attributes through
339 to the decorated result object, permitting other extensions to the
340 TestCase -> TestResult protocol to work.
341
342* It is now possible to trigger code just-in-time after an exception causes
343 a test outcome such as failure or skip. See the testtools MANUAL or
344 ``pydoc testtools.TestCase.addOnException``. (bug #469092)
345
346* New matcher Equals which performs a simple equality test.
347
348* New matcher MatchesAny which looks for a match of any of its arguments.
349
350* TestCase no longer breaks if a TestSkipped exception is raised with no
351 parameters.
352
353* TestCase.run now clones test cases before they are run and runs the clone.
354 This reduces memory footprint in large test runs - state accumulated on
355 test objects during their setup and execution gets freed when test case
356 has finished running unless the TestResult object keeps a reference.
357 NOTE: As test cloning uses deepcopy, this can potentially interfere if
358 a test suite has shared state (such as the testscenarios or testresources
359 projects use). Use the __deepcopy__ hook to control the copying of such
360 objects so that the shared references stay shared.
361
362* Testtools now accepts contributions without copyright assignment under some
363 circumstances. See HACKING for details.
364
365* Testtools now provides a convenient way to run a test suite using the
366 testtools result object: python -m testtools.run testspec [testspec...].
367
368* Testtools now works on Python 3, thanks to Benjamin Peterson.
369
370* Test execution now uses a separate class, testtools.RunTest to run single
371 tests. This can be customised and extended in a more consistent fashion than
372 the previous run method idiom. See pydoc for more information.
373
374* The test doubles that testtools itself uses are now available as part of
375 the testtools API in testtols.testresult.doubles.
376
377* TracebackContent now sets utf8 as the charset encoding, rather than not
378 setting one and encoding with the default encoder.
379
380* With python2.7 testtools.TestSkipped will be the unittest.case.SkipTest
381 exception class making skips compatible with code that manually raises the
382 standard library exception. (bug #490109)
383
384Changes
385-------
386
387* TestCase.getUniqueInteger is now implemented using itertools.count. Thanks
388 to Benjamin Peterson for the patch. (bug #490111)
389
390
3910.9.1
392~~~~~
393
394The new matcher API introduced in 0.9.0 had a small flaw where the matchee
395would be evaluated twice to get a description of the mismatch. This could lead
396to bugs if the act of matching caused side effects to occur in the matchee.
397Since having such side effects isn't desirable, we have changed the API now
398before it has become widespread.
399
400Changes
401-------
402
403* Matcher API changed to avoid evaluating matchee twice. Please consult
404 the API documentation.
405
406* TestCase.getUniqueString now uses the test id, not the test method name,
407 which works nicer with parameterised tests.
408
409Improvements
410------------
411
412* Python2.4 is now supported again.
413
414
4150.9.0
416~~~~~
417
418This release of testtools is perhaps the most interesting and exciting one
419it's ever had. We've continued in bringing together the best practices of unit
420testing from across a raft of different Python projects, but we've also
421extended our mission to incorporating unit testing concepts from other
422languages and from our own research, led by Robert Collins.
423
424We now support skipping and expected failures. We'll make sure that you
425up-call setUp and tearDown, avoiding unexpected testing weirdnesses. We're
426now compatible with Python 2.5, 2.6 and 2.7 unittest library.
427
428All in all, if you are serious about unit testing and want to get the best
429thinking from the whole Python community, you should get this release.
430
431Improvements
432------------
433
434* A new TestResult API has been added for attaching details to test outcomes.
435 This API is currently experimental, but is being prepared with the intent
436 of becoming an upstream Python API. For more details see pydoc
437 testtools.TestResult and the TestCase addDetail / getDetails methods.
438
439* assertThat has been added to TestCase. This new assertion supports
440 a hamcrest-inspired matching protocol. See pydoc testtools.Matcher for
441 details about writing matchers, and testtools.matchers for the included
442 matchers. See http://code.google.com/p/hamcrest/.
443
444* Compatible with Python 2.6 and Python 2.7
445
446* Failing to upcall in setUp or tearDown will now cause a test failure.
447 While the base methods do nothing, failing to upcall is usually a problem
448 in deeper hierarchies, and checking that the root method is called is a
449 simple way to catch this common bug.
450
451* New TestResult decorator ExtendedToOriginalDecorator which handles
452 downgrading extended API calls like addSkip to older result objects that
453 do not support them. This is used internally to make testtools simpler but
454 can also be used to simplify other code built on or for use with testtools.
455
456* New TextTestResult supporting the extended APIs that testtools provides.
457
458* Nose will no longer find 'runTest' tests in classes derived from
459 testtools.testcase.TestCase (bug #312257).
460
461* Supports the Python 2.7/3.1 addUnexpectedSuccess and addExpectedFailure
462 TestResult methods, with a support function 'knownFailure' to let tests
463 trigger these outcomes.
464
465* When using the skip feature with TestResult objects that do not support it
466 a test success will now be reported. Previously an error was reported but
467 production experience has shown that this is too disruptive for projects that
468 are using skips: they cannot get a clean run on down-level result objects.
Note: See TracBrowser for help on using the repository browser.