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