unittest.TestResult¶
-
class
unittest.TestResult(stream=None, descriptions=None, verbosity=None)[source]¶ Holder for test result information.
Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests.
Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred.
Methods¶
__format__ |
default object formatter |
__init__([stream, descriptions, verbosity]) |
|
__new__((S, ...) |
|
__reduce__ |
helper for pickle |
__reduce_ex__ |
helper for pickle |
__repr__() |
|
__sizeof__(() -> int) |
size of object in memory, in bytes |
__subclasshook__ |
Abstract classes can override this to customize issubclass(). |
_count_relevant_tb_levels(tb) |
|
_exc_info_to_string(err, test) |
Converts a sys.exc_info()-style tuple of values into a string. |
_is_relevant_tb_level(tb) |
|
_restoreStdout() |
|
_setupStdout() |
|
addError(*args, **kw) |
Called when an error has occurred. |
addExpectedFailure(test, err) |
Called when an expected failure/error occurred. |
addFailure(*args, **kw) |
Called when an error has occurred. |
addSkip(test, reason) |
Called when a test is skipped. |
addSuccess(test) |
Called when a test has completed successfully |
addUnexpectedSuccess(*args, **kw) |
Called when a test was expected to fail, but succeed. |
printErrors() |
Called by TestRunner after test run |
startTest(test) |
Called when the given test is about to be run |
startTestRun() |
Called once before any tests are executed. |
stop() |
Indicates that the tests should be aborted |
stopTest(test) |
Called when the given test has been run |
stopTestRun() |
Called once after all tests are executed. |
wasSuccessful() |
Tells whether or not this result was a success |