API Reference

Test runner

zope.testrunner.run(defaults=None, args=None, script_parts=None, cwd=None, warnings=None)[source]

Main runner function which can be and is being used from main programs.

Will execute the tests and exit the process according to the test result.

Changed in version 4.8.0: Add the warnings keyword argument. See zope.testrunner.runner.Runner

zope.testrunner.run_internal(defaults=None, args=None, script_parts=None, cwd=None, warnings=None)[source]

Execute tests.

Returns whether errors or failures occured during testing.

Changed in version 4.8.0: Add the warnings keyword argument. See zope.testrunner.runner.Runner

class zope.testrunner.runner.Runner(defaults=None, args=None, found_suites=None, options=None, script_parts=None, cwd=None, warnings=None)[source]

Bases: object

The test runner.

It is the central point of this package and responsible for finding and executing tests as well as configuring itself from the (command-line) options passed into it.

Changed in version 4.8.0: Add the warnings keyword argument. If this is None (the default) and the user hasn’t configured Python otherwise with command-line arguments or environment variables, we will enable the default warnings, including DeprecationWarning, when running tests. Otherwise, it can be any string acceptable to warnings.simplefilter() and that filter will be in effect while running tests.

register_tests(tests)[source]

Registers tests.

run_tests()[source]

Run all tests that were registered.

Returns True if there where failures or False if all tests passed.