4 Changes and improvements to testtools_, grouped by release.
16 * ``DirContains`` correctly exposed, after being accidentally hidden in the
17 great matcher re-organization of 0.9.17. (Jonathan Lange)
23 Three new matchers that'll rock your world.
28 * New, powerful matchers that match items in a dictionary:
30 - ``MatchesDict``, match every key in a dictionary with a key in a
31 dictionary of matchers. For when the set of expected keys is equal to the
34 - ``ContainsDict``, every key in a dictionary of matchers must be
35 found in a dictionary, and the values for those keys must match. For when
36 the set of expected keys is a subset of the set of observed keys.
38 - ``ContainedByDict``, every key in a dictionary must be found in
39 a dictionary of matchers. For when the set of expected keys is a superset
40 of the set of observed keys.
42 The names are a little confusing, sorry. We're still trying to figure out
43 how to present the concept in the simplest way possible.
49 How embarrassing! Three releases in two days.
51 We've worked out the kinks and have confirmation from our downstreams that
52 this is all good. Should be the last release for a little while. Please
53 ignore 0.9.18 and 0.9.17.
58 * Include the matcher tests in the release, allowing the tests to run and
59 pass from the release tarball. (Jonathan Lange)
61 * Fix cosmetic test failures in Python 3.3, introduced during release 0.9.17.
68 Due to an oversight, release 0.9.18 did not contain the new
69 ``testtools.matchers`` package and was thus completely broken. This release
70 corrects that, returning us all to normality.
75 This release brings better discover support and Python3.x improvements. There
76 are still some test failures on Python3.3 but they are cosmetic - the library
77 is as usable there as on any other Python 3 release.
82 * The ``testtools.matchers`` package has been split up. No change to the
83 public interface. (Jonathan Lange)
88 * ``python -m testtools.run discover . --list`` now works. (Robert Collins)
90 * Correctly handling of bytes vs text in JSON content type. (Martin [gz])
96 Some new matchers and a new content helper for JSON content.
98 This is the first release of testtools to drop support for Python 2.4 and 2.5.
99 If you need support for either of those versions, please use testtools 0.9.15.
104 * New content helper, ``json_content`` (Jonathan Lange)
108 * ``ContainsAll`` for asserting one thing is a subset of another
111 * ``SameMembers`` for asserting two iterators have the same members.
114 * Reraising of exceptions in Python 3 is more reliable. (Martin [gz])
120 This is the last release to support Python2.4 and 2.5. It brings in a slew of
121 improvements to test tagging and concurrency, making running large test suites
122 with partitioned workers more reliable and easier to reproduce exact test
123 ordering in a given worker. See our sister project ``testrepository`` for a
124 test runner that uses these features.
129 * ``PlaceHolder`` and ``ErrorHolder`` now support being given result details.
132 * ``ErrorHolder`` is now just a function - all the logic is in ``PlaceHolder``.
135 * ``TestResult`` and all other ``TestResult``-like objects in testtools
136 distinguish between global tags and test-local tags, as per the subunit
137 specification. (Jonathan Lange)
139 * This is the **last** release of testtools that supports Python 2.4 or 2.5.
140 These releases are no longer supported by the Python community and do not
141 receive security updates. If this affects you, you will need to either
142 stay on this release or perform your own backports.
143 (Jonathan Lange, Robert Collins)
145 * ``ThreadsafeForwardingResult`` now forwards global tags as test-local tags,
146 making reasoning about the correctness of the multiplexed stream simpler.
147 This preserves the semantic value (what tags apply to a given test) while
148 consuming less stream size (as no negative-tag statement is needed).
149 (Robert Collins, Gary Poster, #986434)
154 * API documentation corrections. (Raphaël Badin)
156 * ``ConcurrentTestSuite`` now takes an optional ``wrap_result`` parameter
157 that can be used to wrap the ``ThreadsafeForwardingResult``s created by
158 the suite. (Jonathan Lange)
160 * ``Tagger`` added. It's a new ``TestResult`` that tags all tests sent to
161 it with a particular set of tags. (Jonathan Lange)
163 * ``testresultdecorator`` brought over from subunit. (Jonathan Lange)
165 * All ``TestResult`` wrappers now correctly forward ``current_tags`` from
166 their wrapped results, meaning that ``current_tags`` can always be relied
167 upon to return the currently active tags on a test result.
169 * ``TestByTestResult``, a ``TestResult`` that calls a method once per test,
170 added. (Jonathan Lange)
172 * ``ThreadsafeForwardingResult`` correctly forwards ``tags()`` calls where
173 only one of ``new_tags`` or ``gone_tags`` are specified.
174 (Jonathan Lange, #980263)
176 * ``ThreadsafeForwardingResult`` no longer leaks local tags from one test
177 into all future tests run. (Jonathan Lange, #985613)
179 * ``ThreadsafeForwardingResult`` has many, many more tests. (Jonathan Lange)
185 Our sister project, `subunit <https://launchpad.net/subunit>`_, was using a
186 private API that was deleted in the 0.9.13 release. This release restores
187 that API in order to smooth out the upgrade path.
189 If you don't use subunit, then this release won't matter very much to you.
195 Plenty of new matchers and quite a few critical bug fixes (especially to do
196 with stack traces from failed assertions). A net win for all.
201 * ``MatchesAll`` now takes an ``first_only`` keyword argument that changes how
202 mismatches are displayed. If you were previously passing matchers to
203 ``MatchesAll`` with keyword arguments, then this change might affect your
204 test results. (Jonathan Lange)
209 * Actually hide all of the testtools stack for assertion failures. The
210 previous release promised clean stack, but now we actually provide it.
211 (Jonathan Lange, #854769)
213 * ``assertRaises`` now includes the ``repr`` of the callable that failed to raise
214 properly. (Jonathan Lange, #881052)
216 * Asynchronous tests no longer hang when run with trial.
217 (Jonathan Lange, #926189)
219 * ``Content`` objects now have an ``as_text`` method to convert their contents
220 to Unicode text. (Jonathan Lange)
222 * Failed equality assertions now line up. (Jonathan Lange, #879339)
224 * ``FullStackRunTest`` no longer aborts the test run if a test raises an
225 error. (Jonathan Lange)
227 * ``MatchesAll`` and ``MatchesListwise`` both take a ``first_only`` keyword
228 argument. If True, they will report only on the first mismatch they find,
229 and not continue looking for other possible mismatches.
232 * New helper, ``Nullary`` that turns callables with arguments into ones that
233 don't take arguments. (Jonathan Lange)
237 * ``DirContains`` matches the contents of a directory.
238 (Jonathan Lange, James Westby)
240 * ``DirExists`` matches if a directory exists.
241 (Jonathan Lange, James Westby)
243 * ``FileContains`` matches the contents of a file.
244 (Jonathan Lange, James Westby)
246 * ``FileExists`` matches if a file exists.
247 (Jonathan Lange, James Westby)
249 * ``HasPermissions`` matches the permissions of a file. (Jonathan Lange)
251 * ``MatchesPredicate`` matches if a predicate is true. (Jonathan Lange)
253 * ``PathExists`` matches if a path exists. (Jonathan Lange, James Westby)
255 * ``SamePath`` matches if two paths are the same. (Jonathan Lange)
257 * ``TarballContains`` matches the contents of a tarball. (Jonathan Lange)
259 * ``MultiTestResult`` supports the ``tags`` method.
260 (Graham Binns, Francesco Banconi, #914279)
262 * ``ThreadsafeForwardingResult`` supports the ``tags`` method.
263 (Graham Binns, Francesco Banconi, #914279)
265 * ``ThreadsafeForwardingResult`` no longer includes semaphore acquisition time
266 in the test duration (for implicitly timed test runs).
267 (Robert Collins, #914362)
272 This is a very big release. We've made huge improvements on three fronts:
273 1. Test failures are way nicer and easier to read
274 2. Matchers and ``assertThat`` are much more convenient to use
275 3. Correct handling of extended unicode characters
277 We've trimmed off the fat from the stack trace you get when tests fail, we've
278 cut out the bits of error messages that just didn't help, we've made it easier
279 to annotate mismatch failures, to compare complex objects and to match raised
282 Testing code was never this fun.
287 * ``AfterPreproccessing`` renamed to ``AfterPreprocessing``, which is a more
288 correct spelling. Old name preserved for backwards compatibility, but is
289 now deprecated. Please stop using it.
290 (Jonathan Lange, #813460)
292 * ``assertThat`` raises ``MismatchError`` instead of
293 ``TestCase.failureException``. ``MismatchError`` is a subclass of
294 ``AssertionError``, so in most cases this change will not matter. However,
295 if ``self.failureException`` has been set to a non-default value, then
296 mismatches will become test errors rather than test failures.
298 * ``gather_details`` takes two dicts, rather than two detailed objects.
299 (Jonathan Lange, #801027)
301 * ``MatchesRegex`` mismatch now says "<value> does not match /<regex>/" rather
302 than "<regex> did not match <value>". The regular expression contains fewer
303 backslashes too. (Jonathan Lange, #818079)
305 * Tests that run with ``AsynchronousDeferredRunTest`` now have the ``reactor``
306 attribute set to the running reactor. (Jonathan Lange, #720749)
311 * All public matchers are now in ``testtools.matchers.__all__``.
312 (Jonathan Lange, #784859)
314 * ``assertThat`` can actually display mismatches and matchers that contain
315 extended unicode characters. (Jonathan Lange, Martin [gz], #804127)
317 * ``assertThat`` output is much less verbose, displaying only what the mismatch
318 tells us to display. Old-style verbose output can be had by passing
319 ``verbose=True`` to assertThat. (Jonathan Lange, #675323, #593190)
321 * ``assertThat`` accepts a message which will be used to annotate the matcher.
322 This can be given as a third parameter or as a keyword parameter.
325 * Automated the Launchpad part of the release process.
326 (Jonathan Lange, #623486)
328 * Correctly display non-ASCII unicode output on terminals that claim to have a
329 unicode encoding. (Martin [gz], #804122)
331 * ``DocTestMatches`` correctly handles unicode output from examples, rather
332 than raising an error. (Martin [gz], #764170)
334 * ``ErrorHolder`` and ``PlaceHolder`` added to docs. (Jonathan Lange, #816597)
336 * ``ExpectedException`` now matches any exception of the given type by
337 default, and also allows specifying a ``Matcher`` rather than a mere regular
338 expression. (Jonathan Lange, #791889)
340 * ``FixtureSuite`` added, allows test suites to run with a given fixture.
343 * Hide testtools's own stack frames when displaying tracebacks, making it
344 easier for test authors to focus on their errors.
345 (Jonathan Lange, Martin [gz], #788974)
347 * Less boilerplate displayed in test failures and errors.
348 (Jonathan Lange, #660852)
350 * ``MatchesException`` now allows you to match exceptions against any matcher,
351 rather than just regular expressions. (Jonathan Lange, #791889)
353 * ``MatchesException`` now permits a tuple of types rather than a single type
354 (when using the type matching mode). (Robert Collins)
356 * ``MatchesStructure.byEquality`` added to make the common case of matching
357 many attributes by equality much easier. ``MatchesStructure.byMatcher``
358 added in case folk want to match by things other than equality.
361 * New convenience assertions, ``assertIsNone`` and ``assertIsNotNone``.
366 * ``AllMatch`` matches many values against a single matcher.
367 (Jonathan Lange, #615108)
369 * ``Contains``. (Robert Collins)
371 * ``GreaterThan``. (Christian Kampka)
373 * New helper, ``safe_hasattr`` added. (Jonathan Lange)
375 * ``reraise`` added to ``testtools.compat``. (Jonathan Lange)
381 This release brings consistent use of super for better compatibility with
382 multiple inheritance, fixed Python3 support, improvements in fixture and mather
383 outputs and a compat helper for testing libraries that deal with bytestrings.
388 * ``TestCase`` now uses super to call base ``unittest.TestCase`` constructor,
389 ``setUp`` and ``tearDown``. (Tim Cole, #771508)
391 * If, when calling ``useFixture`` an error occurs during fixture set up, we
392 still attempt to gather details from the fixture. (Gavin Panella)
398 * Additional compat helper for ``BytesIO`` for libraries that build on
399 testtools and are working on Python 3 porting. (Robert Collins)
401 * Corrected documentation for ``MatchesStructure`` in the test authors
402 document. (Jonathan Lange)
404 * ``LessThan`` error message now says something that is logically correct.
405 (Gavin Panella, #762008)
407 * Multiple details from a single fixture are now kept separate, rather than
408 being mooshed together. (Gavin Panella, #788182)
410 * Python 3 support now back in action. (Martin [gz], #688729)
412 * ``try_import`` and ``try_imports`` have a callback that is called whenever
413 they fail to import a module. (Martin Pool)
419 The last release of testtools could not be easy_installed. This is considered
420 severe enough for a re-release.
425 * Include ``doc/`` in the source distribution, making testtools installable
426 from PyPI again (Tres Seaver, #757439)
432 Many, many new matchers, vastly expanded documentation, stacks of bug fixes,
433 better unittest2 integration. If you've ever wanted to try out testtools but
434 been afraid to do so, this is the release to try.
440 * The timestamps generated by ``TestResult`` objects when no timing data has
441 been received are now datetime-with-timezone, which allows them to be
442 sensibly serialised and transported. (Robert Collins, #692297)
447 * ``AnnotatedMismatch`` now correctly returns details.
448 (Jonathan Lange, #724691)
450 * distutils integration for the testtools test runner. Can now use it for
451 'python setup.py test'. (Christian Kampka, #693773)
453 * ``EndsWith`` and ``KeysEqual`` now in testtools.matchers.__all__.
454 (Jonathan Lange, #692158)
456 * ``MatchesException`` extended to support a regular expression check against
457 the str() of a raised exception. (Jonathan Lange)
459 * ``MultiTestResult`` now forwards the ``time`` API. (Robert Collins, #692294)
461 * ``MultiTestResult`` now documented in the manual. (Jonathan Lange, #661116)
463 * New content helpers ``content_from_file``, ``content_from_stream`` and
464 ``attach_file`` make it easier to attach file-like objects to a
465 test. (Jonathan Lange, Robert Collins, #694126)
467 * New ``ExpectedException`` context manager to help write tests against things
468 that are expected to raise exceptions. (Aaron Bentley)
472 * ``MatchesListwise`` matches an iterable of matchers against an iterable
473 of values. (Michael Hudson-Doyle)
475 * ``MatchesRegex`` matches a string against a regular expression.
476 (Michael Hudson-Doyle)
478 * ``MatchesStructure`` matches attributes of an object against given
479 matchers. (Michael Hudson-Doyle)
481 * ``AfterPreproccessing`` matches values against a matcher after passing them
482 through a callable. (Michael Hudson-Doyle)
484 * ``MatchesSetwise`` matches an iterable of matchers against an iterable of
485 values, without regard to order. (Michael Hudson-Doyle)
487 * ``setup.py`` can now build a snapshot when Bazaar is installed but the tree
488 is not a Bazaar tree. (Jelmer Vernooij)
490 * Support for running tests using distutils (Christian Kampka, #726539)
492 * Vastly improved and extended documentation. (Jonathan Lange)
494 * Use unittest2 exception classes if available. (Jelmer Vernooij)
500 In this release we bring some very interesting improvements:
502 * new matchers for exceptions, sets, lists, dicts and more.
504 * experimental (works but the contract isn't supported) twisted reactor
507 * The built in runner can now list tests and filter tests (the -l and
508 --load-list options).
513 * addUnexpectedSuccess is translated to addFailure for test results that don't
514 know about addUnexpectedSuccess. Further, it fails the entire result for
515 all testtools TestResults (i.e. wasSuccessful() returns False after
516 addUnexpectedSuccess has been called). Note that when using a delegating
517 result such as ThreadsafeForwardingResult, MultiTestResult or
518 ExtendedToOriginalDecorator then the behaviour of addUnexpectedSuccess is
519 determined by the delegated to result(s).
520 (Jonathan Lange, Robert Collins, #654474, #683332)
522 * startTestRun will reset any errors on the result. That is, wasSuccessful()
523 will always return True immediately after startTestRun() is called. This
524 only applies to delegated test results (ThreadsafeForwardingResult,
525 MultiTestResult and ExtendedToOriginalDecorator) if the delegated to result
526 is a testtools test result - we cannot reliably reset the state of unknown
527 test result class instances. (Jonathan Lange, Robert Collins, #683332)
529 * Responsibility for running test cleanups has been moved to ``RunTest``.
530 This change does not affect public APIs and can be safely ignored by test
531 authors. (Jonathan Lange, #662647)
538 * ``EndsWith`` which complements the existing ``StartsWith`` matcher.
539 (Jonathan Lange, #669165)
541 * ``MatchesException`` matches an exception class and parameters. (Robert
544 * ``KeysEqual`` matches a dictionary with particular keys. (Jonathan Lange)
546 * ``assertIsInstance`` supports a custom error message to be supplied, which
547 is necessary when using ``assertDictEqual`` on Python 2.7 with a
548 ``testtools.TestCase`` base class. (Jelmer Vernooij)
550 * Experimental support for running tests that return Deferreds.
551 (Jonathan Lange, Martin [gz])
553 * Provide a per-test decorator, run_test_with, to specify which RunTest
554 object to use for a given test. (Jonathan Lange, #657780)
556 * Fix the runTest parameter of TestCase to actually work, rather than raising
557 a TypeError. (Jonathan Lange, #657760)
559 * Non-release snapshots of testtools will now work with buildout.
560 (Jonathan Lange, #613734)
562 * Malformed SyntaxErrors no longer blow up the test suite. (Martin [gz])
564 * ``MismatchesAll.describe`` no longer appends a trailing newline.
565 (Michael Hudson-Doyle, #686790)
567 * New helpers for conditionally importing modules, ``try_import`` and
568 ``try_imports``. (Jonathan Lange)
570 * ``Raises`` added to the ``testtools.matchers`` module - matches if the
571 supplied callable raises, and delegates to an optional matcher for validation
572 of the exception. (Robert Collins)
574 * ``raises`` added to the ``testtools.matchers`` module - matches if the
575 supplied callable raises and delegates to ``MatchesException`` to validate
576 the exception. (Jonathan Lange)
578 * Tests will now pass on Python 2.6.4 : an ``Exception`` change made only in
579 2.6.4 and reverted in Python 2.6.5 was causing test failures on that version.
580 (Martin [gz], #689858).
582 * ``testtools.TestCase.useFixture`` has been added to glue with fixtures nicely.
585 * ``testtools.run`` now supports ``-l`` to list tests rather than executing
586 them. This is useful for integration with external test analysis/processing
587 tools like subunit and testrepository. (Robert Collins)
589 * ``testtools.run`` now supports ``--load-list``, which takes a file containing
590 test ids, one per line, and intersects those ids with the tests found. This
591 allows fine grained control of what tests are run even when the tests cannot
592 be named as objects to import (e.g. due to test parameterisation via
593 testscenarios). (Robert Collins)
595 * Update documentation to say how to use testtools.run() on Python 2.4.
596 (Jonathan Lange, #501174)
598 * ``text_content`` conveniently converts a Python string to a Content object.
599 (Jonathan Lange, James Westby)
606 Lots of little cleanups in this release; many small improvements to make your
607 testing life more pleasant.
612 * Cleanups can raise ``testtools.MultipleExceptions`` if they have multiple
613 exceptions to report. For instance, a cleanup which is itself responsible for
614 running several different internal cleanup routines might use this.
616 * Code duplication between assertEqual and the matcher Equals has been removed.
618 * In normal circumstances, a TestCase will no longer share details with clones
619 of itself. (Andrew Bennetts, bug #637725)
621 * Less exception object cycles are generated (reduces peak memory use between
622 garbage collection). (Martin [gz])
624 * New matchers 'DoesNotStartWith' and 'StartsWith' contributed by Canonical
625 from the Launchpad project. Written by James Westby.
627 * Timestamps as produced by subunit protocol clients are now forwarded in the
628 ThreadsafeForwardingResult so correct test durations can be reported.
629 (Martin [gz], Robert Collins, #625594)
631 * With unittest from Python 2.7 skipped tests will now show only the reason
632 rather than a serialisation of all details. (Martin [gz], #625583)
634 * The testtools release process is now a little better documented and a little
635 smoother. (Jonathan Lange, #623483, #623487)
641 Nothing major in this release, just enough small bits and pieces to make it
642 useful enough to upgrade to.
644 In particular, a serious bug in assertThat() has been fixed, it's easier to
645 write Matchers, there's a TestCase.patch() method for those inevitable monkey
646 patches and TestCase.assertEqual gives slightly nicer errors.
651 * 'TestCase.assertEqual' now formats errors a little more nicely, in the
654 * Added `PlaceHolder` and `ErrorHolder`, TestCase-like objects that can be
655 used to add results to a `TestResult`.
657 * 'Mismatch' now takes optional description and details parameters, so
658 custom Matchers aren't compelled to make their own subclass.
660 * jml added a built-in UTF8_TEXT ContentType to make it slightly easier to
661 add details to test results. See bug #520044.
663 * Fix a bug in our built-in matchers where assertThat would blow up if any
664 of them failed. All built-in mismatch objects now provide get_details().
666 * New 'Is' matcher, which lets you assert that a thing is identical to
669 * New 'LessThan' matcher which lets you assert that a thing is less than
672 * TestCase now has a 'patch()' method to make it easier to monkey-patching
673 objects in tests. See the manual for more information. Fixes bug #310770.
675 * MultiTestResult methods now pass back return values from the results it
681 This release fixes some obscure traceback formatting issues that probably
682 weren't affecting you but were certainly breaking our own test suite.
687 * Jamu Kakar has updated classes in testtools.matchers and testtools.runtest
688 to be new-style classes, fixing bug #611273.
693 * Martin[gz] fixed traceback handling to handle cases where extract_tb returns
694 a source line of None. Fixes bug #611307.
696 * Martin[gz] fixed an unicode issue that was causing the tests to fail,
699 * testtools now handles string exceptions (although why would you want to use
700 them?) and formats their tracebacks correctly. Thanks to Martin[gz] for
706 This release overhauls the traceback formatting layer to deal with Python 2
707 line numbers and traceback objects often being local user encoded strings
708 rather than unicode objects. Test discovery has also been added and Python 3.1
709 is also supported. Finally, the Mismatch protocol has been extended to let
710 Matchers collaborate with tests in supplying detailed data about failures.
715 * testtools.utils has been renamed to testtools.compat. Importing
716 testtools.utils will now generate a deprecation warning.
721 * Add machinery for Python 2 to create unicode tracebacks like those used by
722 Python 3. This means testtools no longer throws on encountering non-ascii
723 filenames, source lines, or exception strings when displaying test results.
724 Largely contributed by Martin[gz] with some tweaks from Robert Collins.
726 * James Westby has supplied test discovery support using the Python 2.7
727 TestRunner in testtools.run. This requires the 'discover' module. This
730 * Python 3.1 is now supported, thanks to Martin[gz] for a partial patch.
731 This fixes bug #592375.
733 * TestCase.addCleanup has had its docstring corrected about when cleanups run.
735 * TestCase.skip is now deprecated in favour of TestCase.skipTest, which is the
736 Python2.7 spelling for skip. This closes bug #560436.
738 * Tests work on IronPython patch from Martin[gz] applied.
740 * Thanks to a patch from James Westby testtools.matchers.Mismatch can now
741 supply a get_details method, which assertThat will query to provide
742 additional attachments. This can be used to provide additional detail
743 about the mismatch that doesn't suite being included in describe(). For
744 instance, if the match process was complex, a log of the process could be
745 included, permitting debugging.
747 * testtools.testresults.real._StringException will now answer __str__ if its
748 value is unicode by encoding with UTF8, and vice versa to answer __unicode__.
749 This permits subunit decoded exceptions to contain unicode and still format
755 More matchers, Python 2.4 support, faster test cloning by switching to copy
756 rather than deepcopy and better output when exceptions occur in cleanups are
757 the defining characteristics of this release.
762 * New matcher "Annotate" that adds a simple string message to another matcher,
763 much like the option 'message' parameter to standard library assertFoo
766 * New matchers "Not" and "MatchesAll". "Not" will invert another matcher, and
767 "MatchesAll" that needs a successful match for all of its arguments.
769 * On Python 2.4, where types.FunctionType cannot be deepcopied, testtools will
770 now monkeypatch copy._deepcopy_dispatch using the same trivial patch that
771 added such support to Python 2.5. The monkey patch is triggered by the
772 absence of FunctionType from the dispatch dict rather than a version check.
775 * On windows the test 'test_now_datetime_now' should now work reliably.
777 * TestCase.getUniqueInteger and TestCase.getUniqueString now have docstrings.
779 * TestCase.getUniqueString now takes an optional prefix parameter, so you can
780 now use it in circumstances that forbid strings with '.'s, and such like.
782 * testtools.testcase.clone_test_with_new_id now uses copy.copy, rather than
783 copy.deepcopy. Tests that need a deeper copy should use the copy protocol to
784 control how they are copied. Bug #498869.
786 * The backtrace test result output tests should now pass on windows and other
787 systems where os.sep is not '/'.
789 * When a cleanUp or tearDown exception occurs, it is now accumulated as a new
790 traceback in the test details, rather than as a separate call to addError /
791 addException. This makes testtools work better with most TestResult objects
792 and fixes bug #335816.
798 Python 3 support, more matchers and better consistency with Python 2.7 --
799 you'd think that would be enough for a point release. Well, we here on the
800 testtools project think that you deserve more.
802 We've added a hook so that user code can be called just-in-time whenever there
803 is an exception, and we've also factored out the "run" logic of test cases so
804 that new outcomes can be added without fiddling with the actual flow of logic.
806 It might sound like small potatoes, but it's changes like these that will
807 bring about the end of test frameworks.
813 * A failure in setUp and tearDown now report as failures not as errors.
815 * Cleanups now run after tearDown to be consistent with Python 2.7's cleanup
818 * ExtendedToOriginalDecorator now passes unrecognised attributes through
819 to the decorated result object, permitting other extensions to the
820 TestCase -> TestResult protocol to work.
822 * It is now possible to trigger code just-in-time after an exception causes
823 a test outcome such as failure or skip. See the testtools MANUAL or
824 ``pydoc testtools.TestCase.addOnException``. (bug #469092)
826 * New matcher Equals which performs a simple equality test.
828 * New matcher MatchesAny which looks for a match of any of its arguments.
830 * TestCase no longer breaks if a TestSkipped exception is raised with no
833 * TestCase.run now clones test cases before they are run and runs the clone.
834 This reduces memory footprint in large test runs - state accumulated on
835 test objects during their setup and execution gets freed when test case
836 has finished running unless the TestResult object keeps a reference.
837 NOTE: As test cloning uses deepcopy, this can potentially interfere if
838 a test suite has shared state (such as the testscenarios or testresources
839 projects use). Use the __deepcopy__ hook to control the copying of such
840 objects so that the shared references stay shared.
842 * Testtools now accepts contributions without copyright assignment under some
843 circumstances. See HACKING for details.
845 * Testtools now provides a convenient way to run a test suite using the
846 testtools result object: python -m testtools.run testspec [testspec...].
848 * Testtools now works on Python 3, thanks to Benjamin Peterson.
850 * Test execution now uses a separate class, testtools.RunTest to run single
851 tests. This can be customised and extended in a more consistent fashion than
852 the previous run method idiom. See pydoc for more information.
854 * The test doubles that testtools itself uses are now available as part of
855 the testtools API in testtols.testresult.doubles.
857 * TracebackContent now sets utf8 as the charset encoding, rather than not
858 setting one and encoding with the default encoder.
860 * With python2.7 testtools.TestSkipped will be the unittest.case.SkipTest
861 exception class making skips compatible with code that manually raises the
862 standard library exception. (bug #490109)
867 * TestCase.getUniqueInteger is now implemented using itertools.count. Thanks
868 to Benjamin Peterson for the patch. (bug #490111)
874 The new matcher API introduced in 0.9.0 had a small flaw where the matchee
875 would be evaluated twice to get a description of the mismatch. This could lead
876 to bugs if the act of matching caused side effects to occur in the matchee.
877 Since having such side effects isn't desirable, we have changed the API now
878 before it has become widespread.
883 * Matcher API changed to avoid evaluating matchee twice. Please consult
884 the API documentation.
886 * TestCase.getUniqueString now uses the test id, not the test method name,
887 which works nicer with parameterised tests.
892 * Python2.4 is now supported again.
898 This release of testtools is perhaps the most interesting and exciting one
899 it's ever had. We've continued in bringing together the best practices of unit
900 testing from across a raft of different Python projects, but we've also
901 extended our mission to incorporating unit testing concepts from other
902 languages and from our own research, led by Robert Collins.
904 We now support skipping and expected failures. We'll make sure that you
905 up-call setUp and tearDown, avoiding unexpected testing weirdnesses. We're
906 now compatible with Python 2.5, 2.6 and 2.7 unittest library.
908 All in all, if you are serious about unit testing and want to get the best
909 thinking from the whole Python community, you should get this release.
914 * A new TestResult API has been added for attaching details to test outcomes.
915 This API is currently experimental, but is being prepared with the intent
916 of becoming an upstream Python API. For more details see pydoc
917 testtools.TestResult and the TestCase addDetail / getDetails methods.
919 * assertThat has been added to TestCase. This new assertion supports
920 a hamcrest-inspired matching protocol. See pydoc testtools.Matcher for
921 details about writing matchers, and testtools.matchers for the included
922 matchers. See http://code.google.com/p/hamcrest/.
924 * Compatible with Python 2.6 and Python 2.7
926 * Failing to upcall in setUp or tearDown will now cause a test failure.
927 While the base methods do nothing, failing to upcall is usually a problem
928 in deeper hierarchies, and checking that the root method is called is a
929 simple way to catch this common bug.
931 * New TestResult decorator ExtendedToOriginalDecorator which handles
932 downgrading extended API calls like addSkip to older result objects that
933 do not support them. This is used internally to make testtools simpler but
934 can also be used to simplify other code built on or for use with testtools.
936 * New TextTestResult supporting the extended APIs that testtools provides.
938 * Nose will no longer find 'runTest' tests in classes derived from
939 testtools.testcase.TestCase (bug #312257).
941 * Supports the Python 2.7/3.1 addUnexpectedSuccess and addExpectedFailure
942 TestResult methods, with a support function 'knownFailure' to let tests
943 trigger these outcomes.
945 * When using the skip feature with TestResult objects that do not support it
946 a test success will now be reported. Previously an error was reported but
947 production experience has shown that this is too disruptive for projects that
948 are using skips: they cannot get a clean run on down-level result objects.
951 .. _testtools: http://pypi.python.org/pypi/testtools