skillfed

testtools

Extensions to the Python standard library unit testing framework

testtools v2.9.1 1.8M downloads/30d#3,499 on PyPI100
Permissive license Active released

What it is and what it does

testtools is a mature extension library for Python's unittest that adds custom matchers (reusable assertion predicates), fixture lifecycle management, and rich test result reporting. It lets you attach arbitrary diagnostic data to test failures—log files, system state, environment details—making debugging easier when tests fail in production-like conditions.

The library prioritizes compatibility with the standard library while providing advanced features like parametrized exception handling, multi-result aggregation, and test cloning. It works with Python 3.10+ and PyPy3, making it suitable for projects that need unittest's ecosystem but want more expressive assertions and better failure diagnostics without switching to an entirely different test framework.

Use it for:

  • Writing custom matchers for domain-specific assertions in integration or acceptance tests.
  • Attaching log files, metrics, or environment snapshots to test results for post-mortem debugging.
  • Building test frameworks or libraries that extend unittest while remaining compatible with standard tools.
  • Testing server or service code where fixture setup/teardown and detailed failure context are critical.
  • Projects requiring PyPy3 or Python 3.10+ support while staying within the unittest ecosystem.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

testtools extends Python's standard unittest framework with custom matchers, fixture management, detailed test result reporting, and cross-Python compatibility for Python 3.10+.

Yes. testtools is production-stable, actively maintained, has no dependencies, and solves real problems in unittest-based projects: custom matchers reduce boilerplate, fixture management simplifies setup/teardown, and rich result reporting cuts debugging time. Install it if you're committed to unittest and want better assertions and diagnostics without migrating to pytest.

Install

testtools on PyPI

pip

pip install testtools

uv

uv add testtools

poetry

poetry add testtools

Installing testtools

Before you install

Low install friction with no runtime dependencies. Actively maintained with a recent release (112 days ago) and ongoing repository activity. Supports current Python versions (3.10+).

License in practice

Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions.

Quickstart

pip install testtools

from testtools import TestCase
from testtools.matchers import Equals

class MyTest(TestCase):
    def test_example(self):
        self.assertThat(7 * 7, Equals(49))

Requires Python 3.10 or later.

Verify before relying

  • Whether the matcher ecosystem is large enough for common assertion patterns in your project.
  • Performance characteristics compared to standard unittest or pytest for large test suites.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 112 days since the last release
Last repo commit
First released
Downloads 1,838,139/month — #3,499 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: testtools-2.9.1-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: TestingTyping :: Typed

Tags

unittest extensionscustom test matchersfixture management testingdetailed test reportingpython test frameworkadvanced assertionstest result details
unittest-extensiontest-matchersfixture-management

More Libraries packages