Install & Compatibility
Where this runs
tested against v6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Runner
✓ from zope.testing.testrunner import Runner
✗ from zope.testing.testrunner import Runner
Zope.testing is primarily used via the `zope-testrunner` command-line script after installation. This script automatically discovers tests defined in `unittest.TestCase` classes (in files matching `test_*.py` within `tests/` subpackages) and doctests (in `.txt` files or docstrings). For project setup, ensure your package includes a `tests` directory with test modules.
import unittest
from zope.testing.testrunner.runner import Runner
class MyTests(unittest.TestCase):
def test_example(self):
self.assertTrue(True)
# To run tests programmatically, typically you'd use the command line script
# or a simple test discovery setup. The zope-testrunner script is often preferred.
# Example command line usage for a project with tests in 'my_package/tests/test_*.py':
# zope-testrunner --test-path=my_package --tests-pattern='^test_.*\.py$'
# Example of programmatic runner usage (advanced/specific scenarios):
# from unittest import TestSuite, makeSuite
# suite = TestSuite()
# suite.addTest(makeSuite(MyTests))
# runner = Runner(args=[], found_suites=[suite])
# succeeded = runner.run()
# if not succeeded:
# print("Tests failed!")
Debug
Known issues
breakingZope.testing 6.x and newer officially dropped support for Python 3.9. Ensure your environment uses Python 3.10 or later.fixUpgrade your Python interpreter to 3.10 or a newer supported version.
affects: 6.0+
breakingStarting with Zope 6.0 (which zope.testing aligns with), namespace package declarations switched from the older `pkg_resources` style to PEP 420 native implicit namespaces. This change may cause import issues in certain add-ons or complex package structures built with older tools like `zc.buildout` < 5.fixUpdate `zc.buildout` to version 5+ if used, and review package configurations for PEP 420 compatibility. Manual adjustments to `__init__.py` files for namespace packages might be required if not using modern tools.
affects: 6.0+
deprecatedThe `zope.testing.doctest` module is deprecated. The `zope.testrunner` has been modified since version 3.9.0 to use Python's standard `doctest` module. Directly importing `zope.testing.doctest` for new code is discouraged.fixMigrate any direct usage of `zope.testing.doctest` to the standard `import doctest` and adjust test code accordingly. The `zope-testrunner` will handle standard doctests correctly.
affects: All versions (deprecation noted since 3.9.0)
breakingThe `setup.py test` command, historically used to run tests, is no longer supported by modern `setuptools` versions and has been removed from `zope.testrunner` in version 8.2 and later.fixUse the `zope-testrunner` command-line script directly, or integrate with `tox` for test execution as shown in the library's development setup.
affects: zope.testrunner 8.2+
Upgrade
Version history
6.1latest on PyPI · released Dec 17, 2025
Audit
Dependencies
PythonrequiredRequired Python version for zope.testing 6.x series.
mockoptionalOptional dependency for zope.testing.setupstack.mock functionality.
subunitoptionalOptional dependency for subunit-based test output formatting.
testtoolsoptionalOptional dependency for subunit-based test output formatting.