Registry / testing / zope-testrunner

zope-testrunner

JSON →
library8.2pypypi✓ verified 84d ago

Zope test runner script for running Python unit tests with support for layers, test fixtures, and flexible reporting. Current version is 8.2, compatible with Python >=3.10. Released under the Zope Foundation, maintenance mode with occasional updates.

pip install zope.testrunner
INSTALL
IMPORT
SIG · ZOPE-TESTRUNNER
Z
zope-testrunner
testingpythonv8.2
Install
2.3s avg
Import
478ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.510s · 22MB
glibc
py 3.103.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
Debug
Known issues
breakingIn version 5.0, the Runner class moved from `zope.testrunner` to `zope.testrunner.runner`. Code importing `TestRunner` or using old import path `from zope.testrunner import Runner` will break.
fix
Change imports to `from zope.testrunner.runner import Runner` and use the new API.
affects: <5.0
deprecatedThe command-line option `--test-path` is deprecated in favor of positional arguments. Usage like `zope-testrunner --test-path .` will produce a warning.
fix
Use positional arguments instead: `zope-testrunner .`
affects: >=8.0
gotchaTest layers from `zope.testing` are not automatically discovered; they must be explicitly listed or imported. Many users assume layers are auto-detected.
fix
Ensure layers are imported in the test module or listed via `--layer` option.
affects: all
gotchaWhen running tests programmatically, the `Options` class is not exported. Use a simple object or dict, not the undocumented `Options` class.
fix
Create a plain object with required attributes as shown in quickstart.
affects: all
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.
fix
Use `from zope.testrunner.runner import Runner`
AttributeError: module 'zope.testrunner' has no attribute 'TestRunner'
TestRunner was removed in version 5.0.
fix
Replace `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.
fix
Check 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.
fix
Ensure 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
Agent activity
54 hits · last 30 days
node
46
OpenAI (training)
1
Resources
zope-testrunner — pip install zope-testrunner · libregistry