PyDocs

Nav

Development Tools

TestResult

  • TestResult(stream=None, descriptions=None, verbosity=None)
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.
Members of TestResult

a

addDuration
Called when a test finished to run, regardless of its outcome.
addError
Called when an error has occurred.
addExpectedFailure
Called when an expected failure/error occurred.
addFailure
Called when an error has occurred.
addSkip
Called when a test is skipped.
addSubTest
Called at the end of a subtest.
addSuccess
Called when a test has completed successfully
addUnexpectedSuccess
Called when a test was expected to fail, but succeed.

b

buffer
If set to true, sys.stdout and sys.stderr will be buffered in between startTest() and stopTest() being called.

c

collectedDurations
A list containing 2-tuples of test case names and floats representing the elapsed time of each test which was run.

e

errors
A list containing 2-tuples of TestCase instances and strings holding formatted tracebacks.
expectedFailures
A list containing 2-tuples of TestCase instances and strings holding formatted tracebacks.

f

failfast
If set to true stop() will be called on the first failure or error, halting the test run.
failures
A list containing 2-tuples of TestCase instances and strings holding formatted tracebacks.

s

shouldStop
Set to True when the execution of tests should stop by stop().
skipped
A list containing 2-tuples of TestCase instances and strings holding the reason for skipping the test.
startTest
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
Called when the given test has been run
stopTestRun
Called once after all tests are executed.

t

tb_locals
If set to true then local variables will be shown in tracebacks.
testsRun
The total number of tests run so far.

u

unexpectedSuccesses
A list containing TestCase instances that were marked as expected failures, but succeeded.

w

wasSuccessful
Tells whether or not this result was a success.
0 Examples
No examples for unittest/TestResult.
See Also
No see-alsos for unittest/TestResult
0 Notes
No notes for TestResult