b.t.ExtendedTestResult(testtools.TextTestResult) : class documentation

Part of bzrlib.tests View In Hierarchy

Known subclasses: bzrlib.tests.test_selftest.TestPostMortemDebugging.TracebackRecordingResult, bzrlib.tests.test_selftest.TestThreadLeakDetection.LeakRecordingResult, bzrlib.tests.TextTestResult, bzrlib.tests.VerboseTestResult

Accepts, reports and accumulates the results of running tests.

Compared to the unittest version this class adds support for profiling, benchmarking, stopping as soon as a test fails, and skipping tests. There are further-specialized subclasses for different types of display.

When a test finishes, in whatever way, it calls one of the addSuccess, addFailure or addError classes. These in turn may redirect to a more specific case for the special test results supported by our extended tests.

Note that just one of these objects is fed the results from many tests.

Method __init__ Construct new TestResult.
Method stopTestRun Undocumented
Method getDescription Undocumented
Method startTest Undocumented
Method stopTest Undocumented
Method startTests Undocumented
Method addError Tell result that test finished with an error.
Method addFailure Tell result that test failed.
Method addSuccess Tell result that test completed successfully.
Method addExpectedFailure Undocumented
Method addUnexpectedSuccess Tell result the test unexpectedly passed, counting as a failure
Method addNotSupported The test will not be run because of a missing feature.
Method addSkip A test has not run for 'reason'.
Method addNotApplicable Undocumented
Method progress The test is adjusting the count of tests to run.
Method report_tests_starting Display information before the test run begins
Method report_test_start Display information on the test just about to be run
Method startTestRun Undocumented
Method report_success Undocumented
Method wasStrictlySuccessful Undocumented
Method _extractBenchmarkTime Add a benchmark time for the current test case.
Method _elapsedTestTimeString Return a time string for the overall time the current test has taken.
Method _testTimeString Undocumented
Method _formatTime Format seconds as milliseconds with leading spaces.
Method _shortened_test_description Undocumented
Method _record_traceback_from_test Store the traceback from passed exc_info tuple till
Method _check_leaked_threads See if any threads have leaked since last call
Method _recordTestStartTime Record that a test has started.
Method _count_stored_tests Count of tests instances kept alive due to not succeeding
Method _post_mortem Start a PDB post mortem session.
Method _report_thread_leak Display information on a test that leaked one or more threads
def __init__(self, stream, descriptions, verbosity, bench_history=None, strict=False):
Construct new TestResult.
Parametersbench_historyOptionally, a writable file object to accumulate benchmark results.
def stopTestRun(self):
Undocumented
def getDescription(self, test):
Undocumented
def _extractBenchmarkTime(self, testCase, details=None):
Add a benchmark time for the current test case.
def _elapsedTestTimeString(self):
Return a time string for the overall time the current test has taken.
def _testTimeString(self, testCase):
Undocumented
def _formatTime(self, seconds):
Format seconds as milliseconds with leading spaces.
def _shortened_test_description(self, test):
Undocumented
def _record_traceback_from_test(self, exc_info):
Store the traceback from passed exc_info tuple till
def startTest(self, test):
Undocumented
def stopTest(self, test):
Undocumented
def startTests(self):
Undocumented
def _check_leaked_threads(self, test):
See if any threads have leaked since last call

A sample of live threads is stored in the _active_threads attribute, when this method runs it compares the current live threads and any not in the previous sample are treated as having leaked.

def _recordTestStartTime(self):
Record that a test has started.
def addError(self, test, err):
Tell result that test finished with an error.

Called from the TestCase run() method when the test fails with an unexpected error.

def addFailure(self, test, err):
Tell result that test failed.

Called from the TestCase run() method when the test fails because e.g. an assert() method failed.

def addSuccess(self, test, details=None):
Tell result that test completed successfully.

Called from the TestCase run()

def addExpectedFailure(self, test, err):
Undocumented
def addUnexpectedSuccess(self, test, details=None):
Tell result the test unexpectedly passed, counting as a failure

When the minimum version of testtools required becomes 0.9.8 this can be updated to use the new handling there.

def addNotSupported(self, test, feature):
The test will not be run because of a missing feature.
def addSkip(self, test, reason):
A test has not run for 'reason'.
def addNotApplicable(self, test, reason):
Undocumented
def _count_stored_tests(self):
Count of tests instances kept alive due to not succeeding
def _post_mortem(self, tb=None):
Start a PDB post mortem session.
def progress(self, offset, whence):
The test is adjusting the count of tests to run.
def report_tests_starting(self):
Display information before the test run begins
def report_test_start(self, test):
Display information on the test just about to be run
def _report_thread_leak(self, test, leaked_threads, active_threads):
Display information on a test that leaked one or more threads
def startTestRun(self):
Undocumented
def report_success(self, test):
Undocumented
def wasStrictlySuccessful(self):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.