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