Install & Compatibility
Where this runs
tested against v8.2 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.510s · 22MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.3s · import 0.446s · 23MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TestRunner
✓ from zope.testrunner.runner import Runner
✗ from zope.testrunner import TestRunner
TestRunner was removed in version 5.0; use Runner instead.
Basic example to run tests programmatically.
import sys
from zope.testrunner.runner import Runner
class CustomOptions:
verbose = 2
tests_pattern = 'test*.py'
test_path = ['.']
at_level = None
unit = True
layer = None
all = False
repeat = 0
test_filter = None
report_modules = False
module_path = []
startup = None
runner = Runner(CustomOptions())
runner.run()
# To run tests from command line:
# $ python -m zope.testrunner --test-path .
zope-testrunner --version
Errors
Common errors & fixes
ImportError: cannot import name 'Runner' from 'zope.testrunner'
Incorrect import path; Runner moved to zope.testrunner.runner in version 5.0.
fixUse `from zope.testrunner.runner import Runner`
AttributeError: module 'zope.testrunner' has no attribute 'TestRunner'
TestRunner was removed in version 5.0.
fixReplace `TestRunner` with `Runner` from zope.testrunner.runner.
zope.testrunner.runner.RunnerError: No tests found
The test path or pattern did not match any test files.
fixCheck that `test_path` points to a directory with test files matching `tests_pattern`. Use `--all` to include all files.
TypeError: 'NoneType' object is not callable (when using layers)
A test layer's `setUp` or `tearDown` method is not defined or not found.
fixEnsure all layer classes implement `setUp(self)` and `tearDown(self)` methods.
Upgrade
Version history
8.2latest on PyPI · released Jan 23, 2026
Audit
Dependencies
zope.interfacerequiredRequired for test layer support
sixrequiredUsed for Python 2/3 compatibility, still present