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