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