unittest2 0.5.0: setuptools compatible test collector and Python 2.3 distribution
michael at voidspace.org.uk
Sun Jul 11 23:22:14 CEST 2010
unittest2 0.5.0 has just been released. This version of unittest2 has
"feature parity" with the version of unittest in Python 2.7:
* unittest2 on PyPI http://pypi.python.org/pypi/unittest2
If you want to ensure that your tests run identically under unittest2
and unittest in Python 2.7 you should use unittest2 0.5.0. Later
versions of unittest2 will include changes in unittest made in Python
3.2 and onwards after the release of Python 2.7.
unittest2 is a backport of the recent enhancements in the Python
unittest testing library in Python 2.7.
* New and Improved: unittest2 article
* unittest2 issue tracker
* Mercurial Development Repository:
Improvements in unittest2 over standard unittest in Python 2.6 and
* automatic test discovery from the command line
* failfast, catch and buffer command line options
* class and module level setup and teardowns
* ``addCleanup`` for better resource handling
* test skipping and expected failures
* improvements to ``assertRaises`` and ``assertAlmostEqual``
* *many* new assert methods, plus better failure messages
* ``load_tests`` protocol for customizing test loading
* various other API improvements and fixes
unittest2 is tested with Python 2.4 - 2.7. New in 0.5.0 is a
distribution for Python 2.3 contributed by Mark Roddy.
Also new in 0.5.0 is a setuptools compatible test collector. If you put
``test_suite = 'unittest2.collector'`` in setup.py you can then find and
run your tests (using test discovery) with:
``python setup.py test``
This starts test discovery with the default parameters from the
directory containing setup.py, so it is perhaps most useful as an
example (see unittest2/collector.py).
All Changes in 0.5.0
Addition of a setuptools compatible test collector (very basic). Specify
``test_suite = 'unittest2.collector'`` in your setup.py.
``TestSuite.debug()`` and ``TestCase.debug()`` now execute cleanup
functions and class and module level setups and teardowns.
No longer monkey-patch os.path.relpath for Python 2.4 / 2.5 so that
projects don't accidentally depend on our patching. Contributed by
Added a Python version specific unit2 entrypoint. This will, for
example, create a ``unit2-2.6`` script if unittest2 is installed with
Python 2.6. (Requires setuptools or distribute.)
Python 2.3 compatibility (in the python2.3 branch of the repository),
contributed by Mark Roddy.
setuptools console script entry points are created as '.py' scripts on
Feature parity with the Python 2.7 final release.
More information about the Python-announce-list