class documentation

Reporter for trial's distributed workers. We send things not through a stream, but through an AMP protocol's callRemote method.

Method __init__ No summary
Method addError Send an error to the parent process.
Async Method addErrorFallible Attempt to report an error to the parent process.
Method addExpectedFailure Send an expected failure over.
Method addFailure Send a Failure over.
Method addSkip Send a skip over.
Method addSuccess Send a success to the parent process.
Method addUnexpectedSuccess Send an unexpected success over.
Method gatherReportingResults Get a "result reporting" context manager.
Method printSummary Don't print a summary
Instance Variable ampProtocol Undocumented
Method _call Call f if and only if a "result reporting" context is active.
Method _getFailure Convert a sys.exc_info()-style tuple to a Failure, if necessary.
Method _getFrames Extract frames from a Failure instance.
Method _getTodoReason Get the reason for a Todo.
Constant _DEFAULT_TODO Default message for expected failures and unexpected successes, used only if a Todo is not provided.
Instance Variable _reporting When a "result reporting" context is active, the corresponding context manager. Otherwise, None.

Inherited from TestResult:

Method __repr__ Undocumented
Method done The test suite has finished running.
Method startTest This must be called before the given test is commenced.
Method stopTest This must be called after the given test is completed.
Method wasSuccessful Report whether or not this test suite was successful or not.
Instance Variable expectedFailures Undocumented
Instance Variable skips Undocumented
Instance Variable successes count the number of successes achieved by the test run.
Instance Variable unexpectedSuccesses Undocumented
Method _getTime Undocumented
Instance Variable _lastTime The duration of the current test run. It defaults to None, which means that the test was skipped.
Instance Variable _startTime The time when the current test was started. It defaults to None, which means that the test was skipped.
Instance Variable _testStarted Undocumented
Instance Variable _timings Undocumented
def __init__(self, ampProtocol): (source)
Parameters
ampProtocolThe communication channel with the trial distributed manager which collects all test results.
def addError(self, test: PyUnitTestCase, error: TrialFailure): (source)

Send an error to the parent process.

async def addErrorFallible(self, testName: str, errorObj: TrialFailure): (source)

Attempt to report an error to the parent process.

Unlike addError this can fail asynchronously. This version is for infrastructure code that can apply its own failure handling.

Returns
A Deferred that fires with the result of the attempt.
def addExpectedFailure(self, test, error, todo=None): (source)
def addSkip(self, test, reason): (source)
def addSuccess(self, test: PyUnitTestCase): (source)

Send a success to the parent process.

This must be called in context managed by gatherReportingResults.

def addUnexpectedSuccess(self, test, todo=None): (source)
def gatherReportingResults(self) -> ReportingResults: (source)

Get a "result reporting" context manager.

In a "result reporting" context, asynchronous test result reporting methods may be used safely. Their results (in particular, failures) are available from the context manager.

def printSummary(self): (source)

Don't print a summary

ampProtocol: AMP = (source)

Undocumented

def _call(self, f: Callable[[], T]): (source)

Call f if and only if a "result reporting" context is active.

Parameters
f:Callable[[], T]A function to call. Its result is accumulated into the result reporting context. It may return a Deferred or a coroutine or synchronously raise an exception or return a result value.
Raises
ValueErrorIf no result reporting context is active.
def _getFailure(self, error: TrialFailure) -> Failure: (source)

Convert a sys.exc_info()-style tuple to a Failure, if necessary.

def _getFrames(self, failure: Failure) -> List[str]: (source)

Extract frames from a Failure instance.

def _getTodoReason(self, todo): (source)

Get the reason for a Todo.

If todo is None, return a sensible default.

_DEFAULT_TODO: str = (source)

Default message for expected failures and unexpected successes, used only if a Todo is not provided.

Value
'Test expected to fail'

When a "result reporting" context is active, the corresponding context manager. Otherwise, None.