Registry / testing / zope-testing

zope-testing

JSON →
library6.1pypypiunverified

Zope.testing is a foundational Python package providing a suite of testing frameworks for Zope applications, supporting both doctest and unittest paradigms. It includes a flexible test runner (`zope.testrunner`), along with specialized utilities for test environment cleanup (`zope.testing.cleanup`), HTML form parsing for functional tests (`zope.testing.formparser`), robust logging support (`zope.testing.loggingsupport`), and streamlined setup/teardown automation (`zope.testing.setupstack`). The current version is 6.1, and its release cadence typically aligns with the broader Zope project, seeing updates roughly every 2-6 months.

pip install zope.testing
INSTALL
IMPORT
SIG · ZOPE-TESTING
Z
zope-testing
testingpythonv6.1
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.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.
fix
Upgrade 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.
fix
Update `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.
fix
Migrate 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.
fix
Use 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.
Agent activity
52 hits · last 30 days
node
45
OpenAI (training)
1
Resources
zope-testing — pip install zope-testing · libregistry