class documentation

class ReportingResults: (source)

View In Hierarchy

A mutable container for the result of sending test results back to the parent process.

Since it is possible for these sends to fail asynchronously but the TestResult protocol is not well suited for asynchronous result reporting, results are collected on an instance of this class and when the runner believes the test is otherwise complete, it can collect the results and do something with any errors.

Method __enter__ Begin a new reportable context in which results can be collected.
Method __exit__ End the reportable context.
Method record Record a Deferred instance representing one test result reporting operation.
Instance Variable _reporter The WorkerReporter this object is associated with. This is the object doing the result reporting.
Instance Variable _results A list of Deferred instances representing the results of reporting operations. This is expected to grow over the course of the test run and then be inspected by the runner once the test is over. The public interface to this list is via the context manager interface.
def __enter__(self) -> Sequence[Deferred[object]]: (source)

Begin a new reportable context in which results can be collected.

Returns
Sequence[Deferred[object]]A sequence which will contain the Deferred instances representing the results of all test result reporting that happens while the context manager is active. The sequence is extended as the test runs so its value should not be consumed until the test is over.
def __exit__(self, excType: type[BaseException], excValue: BaseException, excTraceback: TracebackType) -> Literal[False]: (source)

End the reportable context.

def record(self, result: Deferred[object]): (source)

Record a Deferred instance representing one test result reporting operation.

The WorkerReporter this object is associated with. This is the object doing the result reporting.

A list of Deferred instances representing the results of reporting operations. This is expected to grow over the course of the test run and then be inspected by the runner once the test is over. The public interface to this list is via the context manager interface.