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