unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7 and 3.2.

This is a Python 3 compatible version of unittest2. Tested with Python 3.0, 3.1 and 3.2.

Although the PyPI project name is "unittest2py3k", the Python package is called unittest2. Version numbers are the same as the Python 2 unittest2 package.

For full details, including changelog, see:

unittest2py3k is maintained in the unittest-ext repository:

The unittest2 library is generated by pulling the unittest library from the Python trunk and applying a patch which contains changes to add backwards compatability across Python 3.0, 3.1 and 3.2. There is no actual code kept under source control for the project aside from the single patch file.

The process for generating the library is automated via a series of Fabric commands. They are as follows:

  • create_lib: Pulls unittest from 3.2 branch of the Python subversion repository and applies the backwards compatibility patch on it
  • update_patch: Generates a new patch based upon changes to the checkout. Used when additional changes are needed due to changes pulled from Python svn.

By default, the version number of unittest pulled from subversion is taken from the content of default-revision.txt. An alternate revision number can be specified either by editting this file or passing in a revision identifier to fabric using the rev task argument. Any valid subversion revision identifier can be specified, including HEAD which should be used when attempting to pull the latest version. default-revision.txt is utilized to mark a stable revision of unittest in the Python stdlib. When updating unittest2 to include newer features from unittest it is important that the revision number in this file be updated otherwise we risk the patch failing to generate a vaild library. Additionally, if any additional changes to newer unittest code are needed to achieve backwards compatibility, the patch will need to be updated and have the changes committed. This is accomplished simply by generating the unittest2 library, editting the files as necessary, and running the previously mentioned update_patch fabric command.