--- id: unittest2 version: "1.1.0" license: UNKNOWN license_treatment: permissive maintenance: abandoned --- # unittest2 — The new features in unittest backported to Python 2.4+. License: permissive · Maintenance: abandoned · Downloads: 1.3M/mo ## What it is and what it does unittest2 is a backport of unittest improvements introduced in Python 2.7 and later versions, designed to run on older Python releases. It provides a drop-in replacement for the standard unittest module by allowing you to import unittest2 instead of unittest, giving access to modern testing features on legacy Python versions. The package includes enhancements such as additional assert methods with better comparison defaults, assertRaises as a context manager, test discovery, class and module-level fixtures (setUpClass, tearDownClass, setUpModule, tearDownModule), test skipping, and improved command-line tools via the unit2 script. It has no runtime dependencies and installs as a pure Python wheel. Use it for: - Maintaining test suites on Python 2.6 systems that need modern assertion methods without upgrading the Python version. - Running test discovery on legacy Python versions before 2.7 introduced the feature natively. - Using assertRaises as a context manager on Python 2.6 codebases. - Accessing class-level and module-level test fixtures on older Python releases. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Backports unittest features from Python 2.7 and later versions to earlier Python releases, allowing use of modern testing assertions and test discovery on older Python versions. No. The package has been abandoned since 2015 and targets Python versions that reached end-of-life over a decade ago. Modern Python includes all these features natively. Install only if you are maintaining a legacy codebase stuck on Python 2.6 or earlier that cannot be upgraded; otherwise, use the standard unittest module. ## Install pip install unittest2 uv add unittest2 poetry add unittest2 ## Installing unittest2 Before you install: Installation is straightforward with no runtime dependencies. However, the package has been abandoned since 2015 and is no longer maintained. License in practice: Licensed under BSD (permissive), so there are no restrictions on use in proprietary or open-source projects. Quickstart: pip install unittest2 import unittest2 class TestExample(unittest2.TestCase): def test_something(self): self.assertEqual(1, 1) Targets Python 2.4, 2.5, 2.6, 2.7, 3.2, 3.3, 3.4 and pypy; modern Python versions include these features natively. Verify before relying: - Whether unittest2 remains compatible with modern Python tooling and CI/CD systems despite its age. - Current state of the mercurial repository and whether it is still accessible or archived. ## Package facts - License: UNKNOWN (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 1.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags unittest backport, python 2.6 testing, unittest2 assertions, test discovery python 2, unittest context manager, legacy python testing, legacy-python, abandoned [View on SkillFed](https://skillfed.io/packages/unittest2) · [View on PyPI](https://pypi.org/project/unittest2/)