Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!


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.

Recent activity

Mark Roddy

Commits by Mark Roddy were pushed to markroddy/unittest2-py3k-patch

f8114ea - Updated the inheritance of the BaseTestSuite to pull from the underlying unittest library, to match the same inheritance structure of the python 2.x series of ...
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.