unittest.TestResult.addUnexpectedSuccess()

addUnexpectedSuccess(test) Called when the test case test was marked with the expectedFailure() decorator, but succeeded. The default implementation appends the test to the instance’s unexpectedSuccesses attribute.

unittest.TestResult.addSuccess()

addSuccess(test) Called when the test case test succeeds. The default implementation does nothing.

unittest.TestResult.addSubTest()

addSubTest(test, subtest, outcome) Called when a subtest finishes. test is the test case corresponding to the test method. subtest is a custom TestCase instance describing the subtest. If outcome is None, the subtest succeeded. Otherwise, it failed with an exception where outcome is a tuple of the form returned by sys.exc_info(): (type, value, traceback). The default implementation does nothing when the outcome is a success, and records subtest failures as normal failures. New in version 3.

unittest.TestResult.addSkip()

addSkip(test, reason) Called when the test case test is skipped. reason is the reason the test gave for skipping. The default implementation appends a tuple (test, reason) to the instance’s skipped attribute.

unittest.TestResult.addFailure()

addFailure(test, err) Called when the test case test signals a failure. err is a tuple of the form returned by sys.exc_info(): (type, value, traceback). The default implementation appends a tuple (test, formatted_err) to the instance’s failures attribute, where formatted_err is a formatted traceback derived from err.

unittest.TestResult.addExpectedFailure()

addExpectedFailure(test, err) Called when the test case test fails, but was marked with the expectedFailure() decorator. The default implementation appends a tuple (test, formatted_err) to the instance’s expectedFailures attribute, where formatted_err is a formatted traceback derived from err.

unittest.TestResult.addError()

addError(test, err) Called when the test case test raises an unexpected exception. err is a tuple of the form returned by sys.exc_info(): (type, value, traceback). The default implementation appends a tuple (test, formatted_err) to the instance’s errors attribute, where formatted_err is a formatted traceback derived from err.

unittest.TestResult

class unittest.TestResult This class is used to compile information about which tests have succeeded and which have failed. A TestResult object stores the results of a set of tests. The TestCase and TestSuite classes ensure that results are properly recorded; test authors do not need to worry about recording the outcome of tests. Testing frameworks built on top of unittest may want access to the TestResult object generated by running a set of tests for reporting purposes; a TestResult instan

unittest.TestLoader.testMethodPrefix

testMethodPrefix String giving the prefix of method names which will be interpreted as test methods. The default value is 'test'. This affects getTestCaseNames() and all the loadTestsFrom*() methods.

unittest.TestLoader.suiteClass

suiteClass Callable object that constructs a test suite from a list of tests. No methods on the resulting object are needed. The default value is the TestSuite class. This affects all the loadTestsFrom*() methods.