ANN: unittest2 0.4.0 released

Michael Foord michael at
Fri Apr 9 00:47:21 CEST 2010

Hello all,

I'm pleased to announce the release of version 0.4.0 of unittest2.

* unittest2 on PyPI:
* Article introducing unittest2:
* Development docs for unittest (new features documented) 
* Mercurial Development Repository:

unittest2 is an enhanced version of unittest including a standard test 
runner (automatic test discovery), class and module level fixtures 
(``setUpClass`` / ``setUpModule`` etc), many powerful new assert 
methods, better resource management with ``addCleanups`` and a host of 
other new features. These new features are *all* going into the Python 
version of unittest in Python 2.7 and Python 3.2. The point of unittest2 
is that it works with Python 2.4 - 2.6; you can use it now.

The latest release is 0.4.0, which roughly equates to the feature set 
that will be in unittest in Python 2.7 beta 1 which is due out any 
minute now. The last public release of unittest2 I announced was version 
0.2.0 and there have been several new and important features since then.

For a good roundup of the new features, see my blog entry:


The full changelog for versions 0.3.0 and 0.4.0:

2010/04/08 - 0.4.0

Addition of ``removeHandler`` for removing the control-C handler.

``delta`` keyword argument for ``assertAlmostEqual`` and

Addition of -b command line option (and ``TestResult.buffer``) for 
stdout / stderr during test runs.

Addition of ``TestCase.assertNotRegexpMatches``.

Allow test discovery using dotted module names instead of a path.

All imports requiring the signal module are now optional, for compatiblity
with IronPython (or other platforms without this module).

Tests fixed to be compatible with nosetest.

2010/03/26 - 0.3.0

``assertSameElements`` removed and ``assertItemsEqual`` added; assert that
sequences contain the same elements.

Addition of -f/--failfast command line option, stopping test run on first
failure or error.

Addition of -c/--catch command line option for better control-C handling 
test runs.

Added ``BaseTestSuite``, for use by frameworks that don't want to 
support shared
class and module fixtures.

Skipped test methods no longer have ``setUp`` and ``tearDown`` called around

Faulty ``load_tests`` functions no longer halt test discovery.

Using non-strings for failure messages now works.

Potential for ``UnicodeDecodeError`` whilst creating failure messages fixed.

Split out monolithic test module into a package.

BUGFIX: Correct usage message now shown for unit2 scripts.

BUGFIX: ``__unittest`` in module globals trims frames from that module in
reported stacktraces.

All the best,

Michael Foord


More information about the Python-announce-list mailing list