~~~~~
In this release we bring some very interesting improvements:
* new matchers for exceptions, sets, lists, dicts and more.
* experimental (works but the contract isn't supported) twisted reactor
support.
* The built in runner can now list tests and filter tests (the -l and
--load-list options).
Changes
-------
* addUnexpectedSuccess is translated to addFailure for test results that don't
know about addUnexpectedSuccess. Further, it fails the entire result for
all testtools TestResults (i.e. wasSuccessful() returns False after
addUnexpectedSuccess has been called). Note that when using a delegating
result such as ThreadsafeForwardingResult, MultiTestResult or
ExtendedToOriginalDecorator then the behaviour of addUnexpectedSuccess is
determined by the delegated to result(s).
(Jonathan Lange, Robert Collins, 654474, 683332)
* startTestRun will reset any errors on the result. That is, wasSuccessful()
will always return True immediately after startTestRun() is called. This
only applies to delegated test results (ThreadsafeForwardingResult,
MultiTestResult and ExtendedToOriginalDecorator) if the delegated to result
is a testtools test result - we cannot reliably reset the state of unknown
test result class instances. (Jonathan Lange, Robert Collins, 683332)
* Responsibility for running test cleanups has been moved to ``RunTest``.
This change does not affect public APIs and can be safely ignored by test
authors. (Jonathan Lange, 662647)
Improvements
------------
* New matchers:
* ``EndsWith`` which complements the existing ``StartsWith`` matcher.
(Jonathan Lange, 669165)
* ``MatchesException`` matches an exception class and parameters. (Robert
Collins)
* ``KeysEqual`` matches a dictionary with particular keys. (Jonathan Lange)
* ``assertIsInstance`` supports a custom error message to be supplied, which
is necessary when using ``assertDictEqual`` on Python 2.7 with a
``testtools.TestCase`` base class. (Jelmer Vernooij)
* Experimental support for running tests that return Deferreds.
(Jonathan Lange, Martin [gz])
* Provide a per-test decorator, run_test_with, to specify which RunTest
object to use for a given test. (Jonathan Lange, 657780)
* Fix the runTest parameter of TestCase to actually work, rather than raising
a TypeError. (Jonathan Lange, 657760)
* Non-release snapshots of testtools will now work with buildout.
(Jonathan Lange, 613734)
* Malformed SyntaxErrors no longer blow up the test suite. (Martin [gz])
* ``MismatchesAll.describe`` no longer appends a trailing newline.
(Michael Hudson-Doyle, 686790)
* New helpers for conditionally importing modules, ``try_import`` and
``try_imports``. (Jonathan Lange)
* ``Raises`` added to the ``testtools.matchers`` module - matches if the
supplied callable raises, and delegates to an optional matcher for validation
of the exception. (Robert Collins)
* ``raises`` added to the ``testtools.matchers`` module - matches if the
supplied callable raises and delegates to ``MatchesException`` to validate
the exception. (Jonathan Lange)
* Tests will now pass on Python 2.6.4 : an ``Exception`` change made only in
2.6.4 and reverted in Python 2.6.5 was causing test failures on that version.
(Martin [gz], 689858).
* ``testtools.TestCase.useFixture`` has been added to glue with fixtures nicely.
(Robert Collins)
* ``testtools.run`` now supports ``-l`` to list tests rather than executing
them. This is useful for integration with external test analysis/processing
tools like subunit and testrepository. (Robert Collins)
* ``testtools.run`` now supports ``--load-list``, which takes a file containing
test ids, one per line, and intersects those ids with the tests found. This
allows fine grained control of what tests are run even when the tests cannot
be named as objects to import (e.g. due to test parameterisation via
testscenarios). (Robert Collins)
* Update documentation to say how to use testtools.run() on Python 2.4.
(Jonathan Lange, 501174)
* ``text_content`` conveniently converts a Python string to a Content object.
(Jonathan Lange, James Westby)