The test.test_support module contains functions for assisting
with writing regression tests.
The test.test_support module defines the following exceptions:
- exception TestFailed
-
Exception to be raised when a test fails.
- exception TestSkipped
-
Subclass of TestFailed.
Raised when a test is skipped.
This occurs when a needed resource (such as a network connection) is not
available at the time of testing.
- exception ResourceDenied
-
Subclass of TestSkipped.
Raised when a resource (such as a network connection) is not available.
Raised by the requires function.
The test_support module defines the following constants:
- verbose
-
True when verbose output is enabled.
Should be checked when more detailed information is desired about a running
test.
verbose is set by regrtest.py.
- have_unicode
-
True when Unicode support is available.
- is_jython
-
True if the running interpreter is Jython.
- TESTFN
-
Set to the path that a temporary file may be created at.
Any temporary that is created should be closed and unlinked (removed).
The test_support module defines the following functions:
-
-
Removes the module named module_name from sys.modules and deletes
any byte-compiled files of the module.
-
-
Returns True if resource is enabled and available.
The list of available resources is only set when regrtest.py is
executing the tests.
-
-
Raises ResourceDenied if resource is not available.
msg is the argument to ResourceDenied if it is raised.
Always returns true if called by a function whose __name__ is
"__main__"
.
Used when tests are executed by regrtest.py.
-
-
Return the path to the file named filename.
If no match is found filename is returned.
This does not equal a failure since it could be the path to the file.
-
-
Execute unittest.TestCase subclasses passed to the function.
The function scans the classes for methods starting with the name
"test_"
and executes the tests individually.
This is the preferred way to execute tests.
-
-
Execute the unittest.TestSuite instance, suite.
The optional argument testclass accepts one of the test classes in the
suite so as to print out more detailed information on where the testing suite
originated from.
See About this document... for information on suggesting changes.