Add assert_that NEWS entry.
[third_party/testtools] / NEWS
1 testtools NEWS
2 ++++++++++++++
3
4 Changes and improvements to testtools_, grouped by release.
5
6
7 NEXT
8 ~~~~
9
10 Changes
11 -------
12
13 * Removed a number of code paths where Python 2.4 and Python 2.5 were
14   explicitly handled. (Daniel Watkins)
15
16 Improvements
17 ------------
18
19 * Introduce the assert_that function, which allows matchers to be used
20   independent of testtools.TestCase. (Daniel Watkins, #1243834)
21
22 0.9.34
23 ~~~~~~
24
25 Improvements
26 ------------
27
28 * Added ability for ``testtools.TestCase`` instances to force a test to
29   fail, even if no assertions failed. (Thomi Richards)
30
31 * Added ``testtools.content.StacktraceContent``, a content object that
32   automatically creates a ``StackLinesContent`` object containing the current
33   stack trace. (Thomi Richards)
34
35 * ``AnyMatch`` is now exported properly in ``testtools.matchers``.
36   (Robert Collins, Rob Kennedy, github #44)
37
38 * In Python 3.3, if there are duplicate test ids, tests.sort() will
39   fail and raise TypeError. Detect the duplicate test ids firstly in
40   sorted_tests() to ensure that all test ids are unique.
41   (Kui Shi, #1243922)
42
43 * ``json_content`` is now in the ``__all__`` attribute for
44   ``testtools.content``. (Robert Collins)
45
46 * Network tests now bind to 127.0.0.1 to avoid (even temporary) network
47   visible ports. (Benedikt Morbach, github #46)
48
49 * Test listing now explicitly indicates by printing 'Failed to import' and
50   exiting (2) when an import has failed rather than only signalling through the
51   test name. (Robert Collins, #1245672)
52
53 * ``test_compat.TestDetectEncoding.test_bom`` now works on Python 3.3 - the
54   corner case with euc_jp is no longer permitted in Python 3.3 so we can
55   skip it. (Martin [gz], #1251962)
56
57 0.9.33
58 ~~~~~~
59
60 Improvements
61 ------------
62
63 * Added ``addDetailuniqueName`` method to ``testtools.TestCase`` class.
64   (Thomi Richards)
65
66 * Removed some unused code from ``testtools.content.TracebackContent``.
67   (Thomi Richards)
68
69 * Added ``testtools.StackLinesContent``: a content object for displaying
70   pre-processed stack lines. (Thomi Richards)
71
72 * ``StreamSummary`` was calculating testsRun incorrectly: ``exists`` status
73   tests were counted as run tests, but they are not.
74   (Robert Collins, #1203728)
75
76 0.9.32
77 ~~~~~~
78
79 Regular maintenance release.  Special thanks to new contributor, Xiao Hanyu!
80
81 Changes
82 -------
83
84  * ``testttols.compat._format_exc_info`` has been refactored into several
85    smaller functions. (Thomi Richards)
86
87 Improvements
88 ------------
89
90 * Stacktrace filtering no longer hides unittest frames that are surrounded by
91   user frames. We will reenable this when we figure out a better algorithm for
92   retaining meaning. (Robert Collins, #1188420)
93
94 * The compatibility code for skipped tests with unittest2 was broken.
95   (Robert Collins, #1190951)
96
97 * Various documentation improvements (Clint Byrum, Xiao Hanyu).
98
99 0.9.31
100 ~~~~~~
101
102 Improvements
103 ------------
104
105 * ``ExpectedException`` now accepts a msg parameter for describing an error,
106   much the same as assertEquals etc. (Robert Collins)
107
108 0.9.30
109 ~~~~~~
110
111 A new sort of TestResult, the StreamResult has been added, as a prototype for
112 a revised standard library test result API.  Expect this API to change.
113 Although we will try to preserve compatibility for early adopters, it is
114 experimental and we might need to break it if it turns out to be unsuitable.
115
116 Improvements
117 ------------
118 * ``assertRaises`` works properly for exception classes that have custom 
119   metaclasses
120
121 * ``ConcurrentTestSuite`` was silently eating exceptions that propagate from
122   the test.run(result) method call. Ignoring them is fine in a normal test
123   runner, but when they happen in a different thread, the thread that called
124   suite.run() is not in the stack anymore, and the exceptions are lost. We now
125   create a synthetic test recording any such exception.
126   (Robert Collins, #1130429)
127
128 * Fixed SyntaxError raised in ``_compat2x.py`` when installing via Python 3.
129   (Will Bond, #941958)
130
131 * New class ``StreamResult`` which defines the API for the new result type.
132   (Robert Collins)
133
134 * New support class ``ConcurrentStreamTestSuite`` for convenient construction
135   and utilisation of ``StreamToQueue`` objects. (Robert Collins)
136
137 * New support class ``CopyStreamResult`` which forwards events onto multiple
138   ``StreamResult`` objects (each of which receives all the events).
139   (Robert Collins)
140
141 * New support class ``StreamSummary`` which summarises a ``StreamResult``
142   stream compatibly with ``TestResult`` code. (Robert Collins)
143
144 * New support class ``StreamTagger`` which adds or removes tags from
145   ``StreamResult`` events. (RobertCollins)
146
147 * New support class ``StreamToDict`` which converts a ``StreamResult`` to a
148   series of dicts describing a test. Useful for writing trivial stream
149   analysers. (Robert Collins)
150
151 * New support class ``TestControl`` which permits cancelling an in-progress
152   run. (Robert Collins)
153
154 * New support class ``StreamFailFast`` which calls a ``TestControl`` instance
155   to abort the test run when a failure is detected. (Robert Collins)
156
157 * New support class ``ExtendedToStreamDecorator`` which translates both regular
158   unittest TestResult API calls and the ExtendedTestResult API which testtools
159   has supported into the StreamResult API. ExtendedToStreamDecorator also
160   forwards calls made in the StreamResult API, permitting it to be used
161   anywhere a StreamResult is used. Key TestResult query methods like
162   wasSuccessful and shouldStop are synchronised with the StreamResult API
163   calls, but the detailed statistics like the list of errors are not - a
164   separate consumer will be created to support that.
165   (Robert Collins)
166
167 * New support class ``StreamToExtendedDecorator`` which translates
168   ``StreamResult`` API calls into ``ExtendedTestResult`` (or any older
169   ``TestResult``) calls. This permits using un-migrated result objects with
170   new runners / tests. (Robert Collins)
171
172 * New support class ``StreamToQueue`` for sending messages to one
173   ``StreamResult`` from multiple threads. (Robert Collins)
174
175 * New support class ``TimestampingStreamResult`` which adds a timestamp to
176   events with no timestamp. (Robert Collins)
177
178 * New ``TestCase`` decorator ``DecorateTestCaseResult`` that adapts the
179   ``TestResult`` or ``StreamResult`` a case will be run with, for ensuring that
180   a particular result object is used even if the runner running the test doesn't
181   know to use it. (Robert Collins)
182
183 * New test support class ``testtools.testresult.doubles.StreamResult``, which
184   captures all the StreamResult events. (Robert Collins)
185
186 * ``PlaceHolder`` can now hold tags, and applies them before, and removes them
187   after, the test. (Robert Collins)
188
189 * ``PlaceHolder`` can now hold timestamps, and applies them before the test and
190   then before the outcome. (Robert Collins)
191
192 * ``StreamResultRouter`` added. This is useful for demultiplexing - e.g. for
193   partitioning analysis of events or sending feedback encapsulated in
194   StreamResult events back to their source. (Robert Collins)
195
196 * ``testtools.run.TestProgram`` now supports the ``TestRunner`` taking over
197   responsibility for formatting the output of ``--list-tests``.
198   (Robert Collins)
199
200 * The error message for setUp and tearDown upcall errors was broken on Python
201   3.4. (Monty Taylor, Robert Collins, #1140688)
202
203 * The repr of object() on pypy includes the object id, which was breaking a
204   test that accidentally depended on the CPython repr for object().
205   (Jonathan Lange)
206
207 0.9.29
208 ~~~~~~
209
210 A simple bug fix, and better error messages when you don't up-call.
211
212 Changes
213 -------
214
215 * ``testtools.content_type.ContentType`` incorrectly used ',' rather than ';'
216   to separate parameters. (Robert Collins)
217
218 Improvements
219 ------------
220
221 * ``testtools.compat.unicode_output_stream`` was wrapping a stream encoder
222   around ``io.StringIO`` and ``io.TextIOWrapper`` objects, which was incorrect.
223   (Robert Collins)
224
225 * Report the name of the source file for setUp and tearDown upcall errors.
226   (Monty Taylor)
227
228 0.9.28
229 ~~~~~~
230
231 Testtools has moved VCS - https://github.com/testing-cabal/testtools/ is
232 the new home. Bug tracking is still on Launchpad, and releases are on Pypi.
233
234 We made this change to take advantage of the richer ecosystem of tools around
235 Git, and to lower the barrier for new contributors.
236
237 Improvements
238 ------------
239
240 * New ``testtools.testcase.attr`` and ``testtools.testcase.WithAttributes``
241   helpers allow marking up test case methods with simple labels. This permits
242   filtering tests with more granularity than organising them into modules and
243   test classes. (Robert Collins)
244
245 0.9.27
246 ~~~~~~
247
248 Improvements
249 ------------
250
251 * New matcher ``HasLength`` for matching the length of a collection.
252   (Robert Collins)
253
254 * New matcher ``MatchesPredicateWithParams`` make it still easier to create
255   ad hoc matchers. (Robert Collins)
256
257 * We have a simpler release process in future - see doc/hacking.rst.
258   (Robert Collins)
259
260 0.9.26
261 ~~~~~~
262
263 Brown paper bag fix: failed to document the need for setup to be able to use
264 extras. Compounded by pip not supporting setup_requires.
265
266 Changes
267 -------
268
269 * setup.py now can generate egg_info even if extras is not available.
270   Also lists extras in setup_requires for easy_install.
271   (Robert Collins, #1102464)
272
273 0.9.25
274 ~~~~~~
275
276 Changes
277 -------
278
279 * ``python -m testtools.run --load-list`` will now preserve any custom suites
280   (such as ``testtools.FixtureSuite`` or ``testresources.OptimisingTestSuite``)
281   rather than flattening them.
282   (Robert Collins, #827175)
283
284 * Testtools now depends on extras, a small library split out from it to contain
285   generally useful non-testing facilities. Since extras has been around for a
286   couple of testtools releases now, we're making this into a hard dependency of
287   testtools. (Robert Collins)
288
289 * Testtools now uses setuptools rather than distutils so that we can document
290   the extras dependency. (Robert Collins)
291
292 Improvements
293 ------------
294
295 * Testtools will no longer override test code registered details called
296   'traceback' when reporting caught exceptions from test code.
297   (Robert Collins, #812793)
298
299 0.9.24
300 ~~~~~~
301
302 Changes
303 -------
304
305 * ``testtools.run discover`` will now sort the tests it discovered. This is a 
306   workaround for http://bugs.python.org/issue16709. Non-standard test suites
307   are preserved, and their ``sort_tests()`` method called (if they have such an
308   attribute). ``testtools.testsuite.sorted_tests(suite, True)`` can be used by
309   such suites to do a local sort. (Robert Collins, #1091512)
310
311 * ``ThreadsafeForwardingResult`` now defines a stub ``progress`` method, which
312   fixes ``testr run`` of streams containing progress markers (by discarding the 
313   progress data). (Robert Collins, #1019165)
314
315 0.9.23
316 ~~~~~~
317
318 Changes
319 -------
320
321 * ``run.TestToolsTestRunner`` now accepts the verbosity, buffer and failfast
322   arguments the upstream python TestProgram code wants to give it, making it
323   possible to support them in a compatible fashion. (Robert Collins)
324
325 Improvements
326 ------------
327
328 * ``testtools.run`` now supports the ``-f`` or ``--failfast`` parameter.
329   Previously it was advertised in the help but ignored.
330   (Robert Collins, #1090582)
331
332 * ``AnyMatch`` added, a new matcher that matches when any item in a collection
333   matches the given matcher.  (Jonathan Lange)
334
335 * Spelling corrections to documentation.  (Vincent Ladeuil)
336
337 * ``TestProgram`` now has a sane default for its ``testRunner`` argument.
338   (Vincent Ladeuil)
339
340 * The test suite passes on Python 3 again. (Robert Collins)
341
342 0.9.22
343 ~~~~~~
344
345 Improvements
346 ------------
347
348 * ``content_from_file`` and ``content_from_stream`` now accept seek_offset and
349   seek_whence parameters allowing them to be used to grab less than the full
350   stream, or to be used with StringIO streams. (Robert Collins, #1088693)
351
352 0.9.21
353 ~~~~~~
354
355 Improvements
356 ------------
357
358 * ``DirContains`` correctly exposed, after being accidentally hidden in the
359   great matcher re-organization of 0.9.17.  (Jonathan Lange)
360
361
362 0.9.20
363 ~~~~~~
364
365 Three new matchers that'll rock your world.
366
367 Improvements
368 ------------
369
370 * New, powerful matchers that match items in a dictionary:
371
372   - ``MatchesDict``, match every key in a dictionary with a key in a
373     dictionary of matchers.  For when the set of expected keys is equal to the
374     set of observed keys.
375
376   - ``ContainsDict``, every key in a dictionary of matchers must be
377     found in a dictionary, and the values for those keys must match.  For when
378     the set of expected keys is a subset of the set of observed keys.
379
380   - ``ContainedByDict``, every key in a dictionary must be found in
381     a dictionary of matchers.  For when the set of expected keys is a superset
382     of the set of observed keys.
383
384   The names are a little confusing, sorry.  We're still trying to figure out
385   how to present the concept in the simplest way possible.
386
387
388 0.9.19
389 ~~~~~~
390
391 How embarrassing!  Three releases in two days.
392
393 We've worked out the kinks and have confirmation from our downstreams that
394 this is all good.  Should be the last release for a little while.  Please
395 ignore 0.9.18 and 0.9.17.
396
397 Improvements
398 ------------
399
400 * Include the matcher tests in the release, allowing the tests to run and
401   pass from the release tarball.  (Jonathan Lange)
402
403 * Fix cosmetic test failures in Python 3.3, introduced during release 0.9.17.
404   (Jonathan Lange)
405
406
407 0.9.18
408 ~~~~~~
409
410 Due to an oversight, release 0.9.18 did not contain the new
411 ``testtools.matchers`` package and was thus completely broken.  This release
412 corrects that, returning us all to normality.
413
414 0.9.17
415 ~~~~~~
416
417 This release brings better discover support and Python3.x improvements. There
418 are still some test failures on Python3.3 but they are cosmetic - the library
419 is as usable there as on any other Python 3 release.
420
421 Changes
422 -------
423
424 * The ``testtools.matchers`` package has been split up.  No change to the
425   public interface.  (Jonathan Lange)
426
427 Improvements
428 ------------
429
430 * ``python -m testtools.run discover . --list`` now works. (Robert Collins)
431
432 * Correctly handling of bytes vs text in JSON content type. (Martin [gz])
433
434
435 0.9.16
436 ~~~~~~
437
438 Some new matchers and a new content helper for JSON content.
439
440 This is the first release of testtools to drop support for Python 2.4 and 2.5.
441 If you need support for either of those versions, please use testtools 0.9.15.
442
443 Improvements
444 ------------
445
446 * New content helper, ``json_content`` (Jonathan Lange)
447
448 * New matchers:
449
450   * ``ContainsAll`` for asserting one thing is a subset of another
451     (Raphaël Badin)
452
453   * ``SameMembers`` for asserting two iterators have the same members.
454     (Jonathan Lange)
455
456 * Reraising of exceptions in Python 3 is more reliable. (Martin [gz])
457
458
459 0.9.15
460 ~~~~~~
461
462 This is the last release to support Python2.4 and 2.5. It brings in a slew of
463 improvements to test tagging and concurrency, making running large test suites
464 with partitioned workers more reliable and easier to reproduce exact test
465 ordering in a given worker. See our sister project ``testrepository`` for a
466 test runner that uses these features.
467
468 Changes
469 -------
470
471 * ``PlaceHolder`` and ``ErrorHolder`` now support being given result details.
472   (Robert Collins)
473
474 * ``ErrorHolder`` is now just a function - all the logic is in ``PlaceHolder``.
475   (Robert Collins)
476
477 * ``TestResult`` and all other ``TestResult``-like objects in testtools
478   distinguish between global tags and test-local tags, as per the subunit
479   specification.  (Jonathan Lange)
480
481 * This is the **last** release of testtools that supports Python 2.4 or 2.5.
482   These releases are no longer supported by the Python community and do not
483   receive security updates. If this affects you, you will need to either
484   stay on this release or perform your own backports.
485   (Jonathan Lange, Robert Collins)
486
487 * ``ThreadsafeForwardingResult`` now forwards global tags as test-local tags,
488   making reasoning about the correctness of the multiplexed stream simpler.
489   This preserves the semantic value (what tags apply to a given test) while
490   consuming less stream size (as no negative-tag statement is needed).
491   (Robert Collins, Gary Poster, #986434)
492
493 Improvements
494 ------------
495
496 * API documentation corrections. (Raphaël Badin)
497
498 * ``ConcurrentTestSuite`` now takes an optional ``wrap_result`` parameter
499   that can be used to wrap the ``ThreadsafeForwardingResults`` created by
500   the suite.  (Jonathan Lange)
501
502 * ``Tagger`` added.  It's a new ``TestResult`` that tags all tests sent to
503   it with a particular set of tags.  (Jonathan Lange)
504
505 * ``testresultdecorator`` brought over from subunit.  (Jonathan Lange)
506
507 * All ``TestResult`` wrappers now correctly forward ``current_tags`` from
508   their wrapped results, meaning that ``current_tags`` can always be relied
509   upon to return the currently active tags on a test result.
510
511 * ``TestByTestResult``, a ``TestResult`` that calls a method once per test,
512   added.  (Jonathan Lange)
513
514 * ``ThreadsafeForwardingResult`` correctly forwards ``tags()`` calls where
515   only one of ``new_tags`` or ``gone_tags`` are specified.
516   (Jonathan Lange, #980263)
517
518 * ``ThreadsafeForwardingResult`` no longer leaks local tags from one test
519   into all future tests run.  (Jonathan Lange, #985613)
520
521 * ``ThreadsafeForwardingResult`` has many, many more tests.  (Jonathan Lange)
522
523
524 0.9.14
525 ~~~~~~
526
527 Our sister project, `subunit <https://launchpad.net/subunit>`_, was using a
528 private API that was deleted in the 0.9.13 release.  This release restores
529 that API in order to smooth out the upgrade path.
530
531 If you don't use subunit, then this release won't matter very much to you.
532
533
534 0.9.13
535 ~~~~~~
536
537 Plenty of new matchers and quite a few critical bug fixes (especially to do
538 with stack traces from failed assertions).  A net win for all.
539
540 Changes
541 -------
542
543 * ``MatchesAll`` now takes an ``first_only`` keyword argument that changes how
544   mismatches are displayed.  If you were previously passing matchers to
545   ``MatchesAll`` with keyword arguments, then this change might affect your
546   test results.  (Jonathan Lange)
547
548 Improvements
549 ------------
550
551 * Actually hide all of the testtools stack for assertion failures. The
552   previous release promised clean stack, but now we actually provide it.
553   (Jonathan Lange, #854769)
554
555 * ``assertRaises`` now includes the ``repr`` of the callable that failed to raise
556   properly. (Jonathan Lange, #881052)
557
558 * Asynchronous tests no longer hang when run with trial.
559   (Jonathan Lange, #926189)
560
561 * ``Content`` objects now have an ``as_text`` method to convert their contents
562   to Unicode text.  (Jonathan Lange)
563
564 * Failed equality assertions now line up. (Jonathan Lange, #879339)
565
566 * ``FullStackRunTest`` no longer aborts the test run if a test raises an
567   error.  (Jonathan Lange)
568
569 * ``MatchesAll`` and ``MatchesListwise`` both take a ``first_only`` keyword
570   argument.  If True, they will report only on the first mismatch they find,
571   and not continue looking for other possible mismatches.
572   (Jonathan Lange)
573
574 * New helper, ``Nullary`` that turns callables with arguments into ones that
575   don't take arguments.  (Jonathan Lange)
576
577 * New matchers:
578
579   * ``DirContains`` matches the contents of a directory.
580     (Jonathan Lange, James Westby)
581
582   * ``DirExists`` matches if a directory exists.
583     (Jonathan Lange, James Westby)
584
585   * ``FileContains`` matches the contents of a file.
586     (Jonathan Lange, James Westby)
587
588   * ``FileExists`` matches if a file exists.
589     (Jonathan Lange, James Westby)
590
591   * ``HasPermissions`` matches the permissions of a file.  (Jonathan Lange)
592
593   * ``MatchesPredicate`` matches if a predicate is true.  (Jonathan Lange)
594
595   * ``PathExists`` matches if a path exists.  (Jonathan Lange, James Westby)
596
597   * ``SamePath`` matches if two paths are the same.  (Jonathan Lange)
598
599   * ``TarballContains`` matches the contents of a tarball.  (Jonathan Lange)
600
601 * ``MultiTestResult`` supports the ``tags`` method.
602   (Graham Binns, Francesco Banconi, #914279)
603
604 * ``ThreadsafeForwardingResult`` supports the ``tags`` method.
605   (Graham Binns, Francesco Banconi, #914279)
606
607 * ``ThreadsafeForwardingResult`` no longer includes semaphore acquisition time
608   in the test duration (for implicitly timed test runs).
609   (Robert Collins, #914362)
610
611 0.9.12
612 ~~~~~~
613
614 This is a very big release.  We've made huge improvements on three fronts:
615  1. Test failures are way nicer and easier to read
616  2. Matchers and ``assertThat`` are much more convenient to use
617  3. Correct handling of extended unicode characters
618
619 We've trimmed off the fat from the stack trace you get when tests fail, we've
620 cut out the bits of error messages that just didn't help, we've made it easier
621 to annotate mismatch failures, to compare complex objects and to match raised
622 exceptions.
623
624 Testing code was never this fun.
625
626 Changes
627 -------
628
629 * ``AfterPreproccessing`` renamed to ``AfterPreprocessing``, which is a more
630   correct spelling.  Old name preserved for backwards compatibility, but is
631   now deprecated.  Please stop using it.
632   (Jonathan Lange, #813460)
633
634 * ``assertThat`` raises ``MismatchError`` instead of
635   ``TestCase.failureException``.  ``MismatchError`` is a subclass of
636   ``AssertionError``, so in most cases this change will not matter. However,
637   if ``self.failureException`` has been set to a non-default value, then
638   mismatches will become test errors rather than test failures.
639
640 * ``gather_details`` takes two dicts, rather than two detailed objects.
641   (Jonathan Lange, #801027)
642
643 * ``MatchesRegex`` mismatch now says "<value> does not match /<regex>/" rather
644   than "<regex> did not match <value>". The regular expression contains fewer
645   backslashes too. (Jonathan Lange, #818079)
646
647 * Tests that run with ``AsynchronousDeferredRunTest`` now have the ``reactor``
648   attribute set to the running reactor. (Jonathan Lange, #720749)
649
650 Improvements
651 ------------
652
653 * All public matchers are now in ``testtools.matchers.__all__``.
654   (Jonathan Lange, #784859)
655
656 * ``assertThat`` can actually display mismatches and matchers that contain
657   extended unicode characters. (Jonathan Lange, Martin [gz], #804127)
658
659 * ``assertThat`` output is much less verbose, displaying only what the mismatch
660   tells us to display. Old-style verbose output can be had by passing
661   ``verbose=True`` to assertThat. (Jonathan Lange, #675323, #593190)
662
663 * ``assertThat`` accepts a message which will be used to annotate the matcher.
664   This can be given as a third parameter or as a keyword parameter.
665   (Robert Collins)
666
667 * Automated the Launchpad part of the release process.
668   (Jonathan Lange, #623486)
669
670 * Correctly display non-ASCII unicode output on terminals that claim to have a
671   unicode encoding. (Martin [gz], #804122)
672
673 * ``DocTestMatches`` correctly handles unicode output from examples, rather
674   than raising an error. (Martin [gz], #764170)
675
676 * ``ErrorHolder`` and ``PlaceHolder`` added to docs. (Jonathan Lange, #816597)
677
678 * ``ExpectedException`` now matches any exception of the given type by
679   default, and also allows specifying a ``Matcher`` rather than a mere regular
680   expression. (Jonathan Lange, #791889)
681
682 * ``FixtureSuite`` added, allows test suites to run with a given fixture.
683   (Jonathan Lange)
684
685 * Hide testtools's own stack frames when displaying tracebacks, making it
686   easier for test authors to focus on their errors.
687   (Jonathan Lange, Martin [gz], #788974)
688
689 * Less boilerplate displayed in test failures and errors.
690   (Jonathan Lange, #660852)
691
692 * ``MatchesException`` now allows you to match exceptions against any matcher,
693   rather than just regular expressions.  (Jonathan Lange, #791889)
694
695 * ``MatchesException`` now permits a tuple of types rather than a single type
696   (when using the type matching mode).  (Robert Collins)
697
698 * ``MatchesStructure.byEquality`` added to make the common case of matching
699   many attributes by equality much easier.  ``MatchesStructure.byMatcher``
700   added in case folk want to match by things other than equality.
701   (Jonathan Lange)
702
703 * New convenience assertions, ``assertIsNone`` and ``assertIsNotNone``.
704   (Christian Kampka)
705
706 * New matchers:
707
708   * ``AllMatch`` matches many values against a single matcher.
709     (Jonathan Lange, #615108)
710
711   * ``Contains``. (Robert Collins)
712
713   * ``GreaterThan``. (Christian Kampka)
714
715 * New helper, ``safe_hasattr`` added. (Jonathan Lange)
716
717 * ``reraise`` added to ``testtools.compat``. (Jonathan Lange)
718
719
720 0.9.11
721 ~~~~~~
722
723 This release brings consistent use of super for better compatibility with
724 multiple inheritance, fixed Python3 support, improvements in fixture and mather
725 outputs and a compat helper for testing libraries that deal with bytestrings.
726
727 Changes
728 -------
729
730 * ``TestCase`` now uses super to call base ``unittest.TestCase`` constructor,
731   ``setUp`` and ``tearDown``. (Tim Cole, #771508)
732
733 * If, when calling ``useFixture`` an error occurs during fixture set up, we
734   still attempt to gather details from the fixture. (Gavin Panella)
735
736
737 Improvements
738 ------------
739
740 * Additional compat helper for ``BytesIO`` for libraries that build on
741   testtools and are working on Python 3 porting. (Robert Collins)
742
743 * Corrected documentation for ``MatchesStructure`` in the test authors
744   document.  (Jonathan Lange)
745
746 * ``LessThan`` error message now says something that is logically correct.
747   (Gavin Panella, #762008)
748
749 * Multiple details from a single fixture are now kept separate, rather than
750   being mooshed together. (Gavin Panella, #788182)
751
752 * Python 3 support now back in action. (Martin [gz], #688729)
753
754 * ``try_import`` and ``try_imports`` have a callback that is called whenever
755   they fail to import a module.  (Martin Pool)
756
757
758 0.9.10
759 ~~~~~~
760
761 The last release of testtools could not be easy_installed.  This is considered
762 severe enough for a re-release.
763
764 Improvements
765 ------------
766
767 * Include ``doc/`` in the source distribution, making testtools installable
768   from PyPI again (Tres Seaver, #757439)
769
770
771 0.9.9
772 ~~~~~
773
774 Many, many new matchers, vastly expanded documentation, stacks of bug fixes,
775 better unittest2 integration.  If you've ever wanted to try out testtools but
776 been afraid to do so, this is the release to try.
777
778
779 Changes
780 -------
781
782 * The timestamps generated by ``TestResult`` objects when no timing data has
783   been received are now datetime-with-timezone, which allows them to be
784   sensibly serialised and transported. (Robert Collins, #692297)
785
786 Improvements
787 ------------
788
789 * ``AnnotatedMismatch`` now correctly returns details.
790   (Jonathan Lange, #724691)
791
792 * distutils integration for the testtools test runner. Can now use it for
793   'python setup.py test'. (Christian Kampka, #693773)
794
795 * ``EndsWith`` and ``KeysEqual`` now in testtools.matchers.__all__.
796   (Jonathan Lange, #692158)
797
798 * ``MatchesException`` extended to support a regular expression check against
799   the str() of a raised exception.  (Jonathan Lange)
800
801 * ``MultiTestResult`` now forwards the ``time`` API. (Robert Collins, #692294)
802
803 * ``MultiTestResult`` now documented in the manual. (Jonathan Lange, #661116)
804
805 * New content helpers ``content_from_file``, ``content_from_stream`` and
806   ``attach_file`` make it easier to attach file-like objects to a
807   test. (Jonathan Lange, Robert Collins, #694126)
808
809 * New ``ExpectedException`` context manager to help write tests against things
810   that are expected to raise exceptions. (Aaron Bentley)
811
812 * New matchers:
813
814   * ``MatchesListwise`` matches an iterable of matchers against an iterable
815     of values. (Michael Hudson-Doyle)
816
817   * ``MatchesRegex`` matches a string against a regular expression.
818     (Michael Hudson-Doyle)
819
820   * ``MatchesStructure`` matches attributes of an object against given
821     matchers.  (Michael Hudson-Doyle)
822
823   * ``AfterPreproccessing`` matches values against a matcher after passing them
824     through a callable.  (Michael Hudson-Doyle)
825
826   * ``MatchesSetwise`` matches an iterable of matchers against an iterable of
827     values, without regard to order.  (Michael Hudson-Doyle)
828
829 * ``setup.py`` can now build a snapshot when Bazaar is installed but the tree
830   is not a Bazaar tree. (Jelmer Vernooij)
831
832 * Support for running tests using distutils (Christian Kampka, #726539)
833
834 * Vastly improved and extended documentation. (Jonathan Lange)
835
836 * Use unittest2 exception classes if available. (Jelmer Vernooij)
837
838
839 0.9.8
840 ~~~~~
841
842 In this release we bring some very interesting improvements:
843
844 * new matchers for exceptions, sets, lists, dicts and more.
845
846 * experimental (works but the contract isn't supported) twisted reactor
847   support.
848
849 * The built in runner can now list tests and filter tests (the -l and
850   --load-list options).
851
852 Changes
853 -------
854
855 * addUnexpectedSuccess is translated to addFailure for test results that don't
856   know about addUnexpectedSuccess.  Further, it fails the entire result for
857   all testtools TestResults (i.e. wasSuccessful() returns False after
858   addUnexpectedSuccess has been called). Note that when using a delegating
859   result such as ThreadsafeForwardingResult, MultiTestResult or
860   ExtendedToOriginalDecorator then the behaviour of addUnexpectedSuccess is
861   determined by the delegated to result(s).
862   (Jonathan Lange, Robert Collins, #654474, #683332)
863
864 * startTestRun will reset any errors on the result.  That is, wasSuccessful()
865   will always return True immediately after startTestRun() is called. This
866   only applies to delegated test results (ThreadsafeForwardingResult,
867   MultiTestResult and ExtendedToOriginalDecorator) if the delegated to result
868   is a testtools test result - we cannot reliably reset the state of unknown
869   test result class instances. (Jonathan Lange, Robert Collins, #683332)
870
871 * Responsibility for running test cleanups has been moved to ``RunTest``.
872   This change does not affect public APIs and can be safely ignored by test
873   authors.  (Jonathan Lange, #662647)
874
875 Improvements
876 ------------
877
878 * New matchers:
879
880   * ``EndsWith`` which complements the existing ``StartsWith`` matcher.
881     (Jonathan Lange, #669165)
882
883   * ``MatchesException`` matches an exception class and parameters. (Robert
884     Collins)
885
886   * ``KeysEqual`` matches a dictionary with particular keys.  (Jonathan Lange)
887
888 * ``assertIsInstance`` supports a custom error message to be supplied, which
889   is necessary when using ``assertDictEqual`` on Python 2.7 with a
890   ``testtools.TestCase`` base class. (Jelmer Vernooij)
891
892 * Experimental support for running tests that return Deferreds.
893   (Jonathan Lange, Martin [gz])
894
895 * Provide a per-test decorator, run_test_with, to specify which RunTest
896   object to use for a given test.  (Jonathan Lange, #657780)
897
898 * Fix the runTest parameter of TestCase to actually work, rather than raising
899   a TypeError.  (Jonathan Lange, #657760)
900
901 * Non-release snapshots of testtools will now work with buildout.
902   (Jonathan Lange, #613734)
903
904 * Malformed SyntaxErrors no longer blow up the test suite.  (Martin [gz])
905
906 * ``MismatchesAll.describe`` no longer appends a trailing newline.
907   (Michael Hudson-Doyle, #686790)
908
909 * New helpers for conditionally importing modules, ``try_import`` and
910   ``try_imports``.  (Jonathan Lange)
911
912 * ``Raises`` added to the ``testtools.matchers`` module - matches if the
913   supplied callable raises, and delegates to an optional matcher for validation
914   of the exception. (Robert Collins)
915
916 * ``raises`` added to the ``testtools.matchers`` module - matches if the
917   supplied callable raises and delegates to ``MatchesException`` to validate
918   the exception. (Jonathan Lange)
919
920 * Tests will now pass on Python 2.6.4 : an ``Exception`` change made only in
921   2.6.4 and reverted in Python 2.6.5 was causing test failures on that version.
922   (Martin [gz], #689858).
923
924 * ``testtools.TestCase.useFixture`` has been added to glue with fixtures nicely.
925   (Robert Collins)
926
927 * ``testtools.run`` now supports ``-l`` to list tests rather than executing
928   them. This is useful for integration with external test analysis/processing
929   tools like subunit and testrepository. (Robert Collins)
930
931 * ``testtools.run`` now supports ``--load-list``, which takes a file containing
932   test ids, one per line, and intersects those ids with the tests found. This
933   allows fine grained control of what tests are run even when the tests cannot
934   be named as objects to import (e.g. due to test parameterisation via
935   testscenarios). (Robert Collins)
936
937 * Update documentation to say how to use testtools.run() on Python 2.4.
938   (Jonathan Lange, #501174)
939
940 * ``text_content`` conveniently converts a Python string to a Content object.
941   (Jonathan Lange, James Westby)
942
943
944
945 0.9.7
946 ~~~~~
947
948 Lots of little cleanups in this release; many small improvements to make your
949 testing life more pleasant.
950
951 Improvements
952 ------------
953
954 * Cleanups can raise ``testtools.MultipleExceptions`` if they have multiple
955   exceptions to report. For instance, a cleanup which is itself responsible for
956   running several different internal cleanup routines might use this.
957
958 * Code duplication between assertEqual and the matcher Equals has been removed.
959
960 * In normal circumstances, a TestCase will no longer share details with clones
961   of itself. (Andrew Bennetts, bug #637725)
962
963 * Less exception object cycles are generated (reduces peak memory use between
964   garbage collection). (Martin [gz])
965
966 * New matchers 'DoesNotStartWith' and 'StartsWith' contributed by Canonical
967   from the Launchpad project. Written by James Westby.
968
969 * Timestamps as produced by subunit protocol clients are now forwarded in the
970   ThreadsafeForwardingResult so correct test durations can be reported.
971   (Martin [gz], Robert Collins, #625594)
972
973 * With unittest from Python 2.7 skipped tests will now show only the reason
974   rather than a serialisation of all details. (Martin [gz], #625583)
975
976 * The testtools release process is now a little better documented and a little
977   smoother.  (Jonathan Lange, #623483, #623487)
978
979
980 0.9.6
981 ~~~~~
982
983 Nothing major in this release, just enough small bits and pieces to make it
984 useful enough to upgrade to.
985
986 In particular, a serious bug in assertThat() has been fixed, it's easier to
987 write Matchers, there's a TestCase.patch() method for those inevitable monkey
988 patches and TestCase.assertEqual gives slightly nicer errors.
989
990 Improvements
991 ------------
992
993 * 'TestCase.assertEqual' now formats errors a little more nicely, in the
994   style of bzrlib.
995
996 * Added `PlaceHolder` and `ErrorHolder`, TestCase-like objects that can be
997   used to add results to a `TestResult`.
998
999 * 'Mismatch' now takes optional description and details parameters, so
1000   custom Matchers aren't compelled to make their own subclass.
1001
1002 * jml added a built-in UTF8_TEXT ContentType to make it slightly easier to
1003   add details to test results. See bug #520044.
1004
1005 * Fix a bug in our built-in matchers where assertThat would blow up if any
1006   of them failed. All built-in mismatch objects now provide get_details().
1007
1008 * New 'Is' matcher, which lets you assert that a thing is identical to
1009   another thing.
1010
1011 * New 'LessThan' matcher which lets you assert that a thing is less than
1012   another thing.
1013
1014 * TestCase now has a 'patch()' method to make it easier to monkey-patching
1015   objects in tests. See the manual for more information. Fixes bug #310770.
1016
1017 * MultiTestResult methods now pass back return values from the results it
1018   forwards to.
1019
1020 0.9.5
1021 ~~~~~
1022
1023 This release fixes some obscure traceback formatting issues that probably
1024 weren't affecting you but were certainly breaking our own test suite.
1025
1026 Changes
1027 -------
1028
1029 * Jamu Kakar has updated classes in testtools.matchers and testtools.runtest
1030   to be new-style classes, fixing bug #611273.
1031
1032 Improvements
1033 ------------
1034
1035 * Martin[gz] fixed traceback handling to handle cases where extract_tb returns
1036   a source line of None. Fixes bug #611307.
1037
1038 * Martin[gz] fixed an unicode issue that was causing the tests to fail,
1039   closing bug #604187.
1040
1041 * testtools now handles string exceptions (although why would you want to use
1042   them?) and formats their tracebacks correctly. Thanks to Martin[gz] for
1043   fixing bug #592262.
1044
1045 0.9.4
1046 ~~~~~
1047
1048 This release overhauls the traceback formatting layer to deal with Python 2
1049 line numbers and traceback objects often being local user encoded strings
1050 rather than unicode objects. Test discovery has also been added and Python 3.1
1051 is also supported. Finally, the Mismatch protocol has been extended to let
1052 Matchers collaborate with tests in supplying detailed data about failures.
1053
1054 Changes
1055 -------
1056
1057 * testtools.utils has been renamed to testtools.compat. Importing
1058   testtools.utils will now generate a deprecation warning.
1059
1060 Improvements
1061 ------------
1062
1063 * Add machinery for Python 2 to create unicode tracebacks like those used by
1064   Python 3. This means testtools no longer throws on encountering non-ascii
1065   filenames, source lines, or exception strings when displaying test results.
1066   Largely contributed by Martin[gz] with some tweaks from Robert Collins.
1067
1068 * James Westby has supplied test discovery support using the Python 2.7
1069   TestRunner in testtools.run. This requires the 'discover' module. This
1070   closes bug #250764.
1071
1072 * Python 3.1 is now supported, thanks to Martin[gz] for a partial patch.
1073   This fixes bug #592375.
1074
1075 * TestCase.addCleanup has had its docstring corrected about when cleanups run.
1076
1077 * TestCase.skip is now deprecated in favour of TestCase.skipTest, which is the
1078   Python2.7 spelling for skip. This closes bug #560436.
1079
1080 * Tests work on IronPython patch from Martin[gz] applied.
1081
1082 * Thanks to a patch from James Westby testtools.matchers.Mismatch can now
1083   supply a get_details method, which assertThat will query to provide
1084   additional attachments. This can be used to provide additional detail
1085   about the mismatch that doesn't suite being included in describe(). For
1086   instance, if the match process was complex, a log of the process could be
1087   included, permitting debugging.
1088
1089 * testtools.testresults.real._StringException will now answer __str__ if its
1090   value is unicode by encoding with UTF8, and vice versa to answer __unicode__.
1091   This permits subunit decoded exceptions to contain unicode and still format
1092   correctly.
1093
1094 0.9.3
1095 ~~~~~
1096
1097 More matchers, Python 2.4 support, faster test cloning by switching to copy
1098 rather than deepcopy and better output when exceptions occur in cleanups are
1099 the defining characteristics of this release.
1100
1101 Improvements
1102 ------------
1103
1104 * New matcher "Annotate" that adds a simple string message to another matcher,
1105   much like the option 'message' parameter to standard library assertFoo
1106   methods.
1107
1108 * New matchers "Not" and "MatchesAll". "Not" will invert another matcher, and
1109   "MatchesAll" that needs a successful match for all of its arguments.
1110
1111 * On Python 2.4, where types.FunctionType cannot be deepcopied, testtools will
1112   now monkeypatch copy._deepcopy_dispatch using the same trivial patch that
1113   added such support to Python 2.5. The monkey patch is triggered by the
1114   absence of FunctionType from the dispatch dict rather than a version check.
1115   Bug #498030.
1116
1117 * On windows the test 'test_now_datetime_now' should now work reliably.
1118
1119 * TestCase.getUniqueInteger and TestCase.getUniqueString now have docstrings.
1120
1121 * TestCase.getUniqueString now takes an optional prefix parameter, so you can
1122   now use it in circumstances that forbid strings with '.'s, and such like.
1123
1124 * testtools.testcase.clone_test_with_new_id now uses copy.copy, rather than
1125   copy.deepcopy. Tests that need a deeper copy should use the copy protocol to
1126   control how they are copied. Bug #498869.
1127
1128 * The backtrace test result output tests should now pass on windows and other
1129   systems where os.sep is not '/'.
1130
1131 * When a cleanUp or tearDown exception occurs, it is now accumulated as a new
1132   traceback in the test details, rather than as a separate call to addError / 
1133   addException. This makes testtools work better with most TestResult objects
1134   and fixes bug #335816.
1135
1136
1137 0.9.2
1138 ~~~~~
1139
1140 Python 3 support, more matchers and better consistency with Python 2.7 --
1141 you'd think that would be enough for a point release. Well, we here on the
1142 testtools project think that you deserve more.
1143
1144 We've added a hook so that user code can be called just-in-time whenever there
1145 is an exception, and we've also factored out the "run" logic of test cases so
1146 that new outcomes can be added without fiddling with the actual flow of logic.
1147
1148 It might sound like small potatoes, but it's changes like these that will
1149 bring about the end of test frameworks.
1150
1151
1152 Improvements
1153 ------------
1154
1155 * A failure in setUp and tearDown now report as failures not as errors.
1156
1157 * Cleanups now run after tearDown to be consistent with Python 2.7's cleanup
1158   feature.
1159
1160 * ExtendedToOriginalDecorator now passes unrecognised attributes through
1161   to the decorated result object, permitting other extensions to the
1162   TestCase -> TestResult protocol to work.
1163
1164 * It is now possible to trigger code just-in-time after an exception causes
1165   a test outcome such as failure or skip. See the testtools MANUAL or
1166   ``pydoc testtools.TestCase.addOnException``. (bug #469092)
1167
1168 * New matcher Equals which performs a simple equality test.
1169
1170 * New matcher MatchesAny which looks for a match of any of its arguments.
1171
1172 * TestCase no longer breaks if a TestSkipped exception is raised with no
1173   parameters.
1174
1175 * TestCase.run now clones test cases before they are run and runs the clone.
1176   This reduces memory footprint in large test runs - state accumulated on
1177   test objects during their setup and execution gets freed when test case
1178   has finished running unless the TestResult object keeps a reference.
1179   NOTE: As test cloning uses deepcopy, this can potentially interfere if
1180   a test suite has shared state (such as the testscenarios or testresources
1181   projects use).  Use the __deepcopy__ hook to control the copying of such
1182   objects so that the shared references stay shared.
1183
1184 * Testtools now accepts contributions without copyright assignment under some
1185   circumstances. See HACKING for details.
1186
1187 * Testtools now provides a convenient way to run a test suite using the
1188   testtools result object: python -m testtools.run testspec [testspec...].
1189
1190 * Testtools now works on Python 3, thanks to Benjamin Peterson.
1191
1192 * Test execution now uses a separate class, testtools.RunTest to run single
1193   tests. This can be customised and extended in a more consistent fashion than
1194   the previous run method idiom. See pydoc for more information.
1195
1196 * The test doubles that testtools itself uses are now available as part of
1197   the testtools API in testtols.testresult.doubles.
1198
1199 * TracebackContent now sets utf8 as the charset encoding, rather than not
1200   setting one and encoding with the default encoder.
1201
1202 * With python2.7 testtools.TestSkipped will be the unittest.case.SkipTest
1203   exception class making skips compatible with code that manually raises the
1204   standard library exception. (bug #490109)
1205
1206 Changes
1207 -------
1208
1209 * TestCase.getUniqueInteger is now implemented using itertools.count. Thanks
1210   to Benjamin Peterson for the patch. (bug #490111)
1211
1212
1213 0.9.1
1214 ~~~~~
1215
1216 The new matcher API introduced in 0.9.0 had a small flaw where the matchee
1217 would be evaluated twice to get a description of the mismatch. This could lead
1218 to bugs if the act of matching caused side effects to occur in the matchee.
1219 Since having such side effects isn't desirable, we have changed the API now
1220 before it has become widespread.
1221
1222 Changes
1223 -------
1224
1225 * Matcher API changed to avoid evaluating matchee twice. Please consult
1226   the API documentation.
1227
1228 * TestCase.getUniqueString now uses the test id, not the test method name,
1229   which works nicer with parameterised tests.
1230
1231 Improvements
1232 ------------
1233
1234 * Python2.4 is now supported again.
1235
1236
1237 0.9.0
1238 ~~~~~
1239
1240 This release of testtools is perhaps the most interesting and exciting one
1241 it's ever had. We've continued in bringing together the best practices of unit
1242 testing from across a raft of different Python projects, but we've also
1243 extended our mission to incorporating unit testing concepts from other
1244 languages and from our own research, led by Robert Collins.
1245
1246 We now support skipping and expected failures. We'll make sure that you
1247 up-call setUp and tearDown, avoiding unexpected testing weirdnesses. We're
1248 now compatible with Python 2.5, 2.6 and 2.7 unittest library.
1249
1250 All in all, if you are serious about unit testing and want to get the best
1251 thinking from the whole Python community, you should get this release.
1252
1253 Improvements
1254 ------------
1255
1256 * A new TestResult API has been added for attaching details to test outcomes.
1257   This API is currently experimental, but is being prepared with the intent
1258   of becoming an upstream Python API. For more details see pydoc
1259   testtools.TestResult and the TestCase addDetail / getDetails methods.
1260
1261 * assertThat has been added to TestCase. This new assertion supports
1262   a hamcrest-inspired matching protocol. See pydoc testtools.Matcher for
1263   details about writing matchers, and testtools.matchers for the included
1264   matchers. See http://code.google.com/p/hamcrest/.
1265
1266 * Compatible with Python 2.6 and Python 2.7
1267
1268 * Failing to upcall in setUp or tearDown will now cause a test failure.
1269   While the base methods do nothing, failing to upcall is usually a problem
1270   in deeper hierarchies, and checking that the root method is called is a
1271   simple way to catch this common bug.
1272
1273 * New TestResult decorator ExtendedToOriginalDecorator which handles
1274   downgrading extended API calls like addSkip to older result objects that
1275   do not support them. This is used internally to make testtools simpler but
1276   can also be used to simplify other code built on or for use with testtools.
1277
1278 * New TextTestResult supporting the extended APIs that testtools provides.
1279
1280 * Nose will no longer find 'runTest' tests in classes derived from
1281    testtools.testcase.TestCase (bug #312257).
1282
1283 * Supports the Python 2.7/3.1 addUnexpectedSuccess and addExpectedFailure
1284   TestResult methods, with a support function 'knownFailure' to let tests
1285   trigger these outcomes.
1286
1287 * When using the skip feature with TestResult objects that do not support it
1288   a test success will now be reported. Previously an error was reported but
1289   production experience has shown that this is too disruptive for projects that
1290   are using skips: they cannot get a clean run on down-level result objects.
1291
1292
1293 .. _testtools: http://pypi.python.org/pypi/testtools