Go to the latest version of this document.

# ``twisted`.`trial`.`runner`.`TrialRunner``

class documentation

`class TrialRunner: (source)`

View In Hierarchy

A specialised runner that the trial front end uses.

Method | `run` | Run the test or suite and return a result object.
Method | `runUntilFailure` | Repeatedly run `test` until it fails.
Constant | `DEBUG` | Undocumented
Constant | `DRY_RUN` | Undocumented
Instance Variable | `debugger` | In debug mode, an object to use to launch the debugger.
Instance Variable | `log` | An object to give to the reporter to use as a log publisher.
Instance Variable | `logfile` | The path to the file to write the test run log.
Instance Variable | `mode` | Either `None` for a normal test run, `TrialRunner.DEBUG` for a run in the debugger, or `TrialRunner.DRY_RUN` to collect and report the tests but not call any of them.
Instance Variable | `profile` | `True` to run the tests with a profiler enabled.
Instance Variable | `reporterFactory` | A callable to create a reporter to use.
Instance Variable | `stream` | The file to report results to.
Instance Variable | `uncleanWarnings` | `True` to report dirty reactor errors as warnings, `False` to report them as test-failing errors.
Instance Variable | `workingDirectory` | A path template to a directory which will be the process's working directory while the tests are running.
Property | `rterrors` | Undocumented
Property | `tbformat` | Undocumented
Method | `_makeResult` | Undocumented
Method | `_runWithoutDecoration` | Private helper that runs the given test but doesn't decorate it.
Instance Variable | `_exitFirst` | `True` to stop after the first failed test. `False` to run the whole suite.
Instance Variable | `_forceGarbageCollection` | `True` to perform a full garbage collection at least after each test. `False` to let garbage collection run only when it normally would.
Instance Variable | `_realTimeErrors` | `True` if errors should be reported as they happen. `False` if they should only be reported at the end of the test run in the summary.
Instance Variable | `_tracebackFormat` | A format name to use with `Failure` for reporting failures.

def run(self, test: `pyunit.TestCase | pyunit.TestSuite`) -> `itrial.IReporter`: (source)

Run the test or suite and return a result object.

def runUntilFailure(self, test: `pyunit.TestCase | pyunit.TestSuite`) -> `itrial.IReporter`: (source)

Repeatedly run `test` until it fails.

DEBUG: `str` = (source)

Undocumented

Value

    'debug'

DRY_RUN: `str` = (source)

Undocumented

Value

    'dry-run'

debugger: `_Debugger | None` = (source)

In debug mode, an object to use to launch the debugger.

log = (source)

An object to give to the reporter to use as a log publisher.

logfile: `str` = (source)

The path to the file to write the test run log.

mode: `str | None` = (source)

Either `None` for a normal test run, `TrialRunner.DEBUG` for a run in the debugger, or `TrialRunner.DRY_RUN` to collect and report the tests but not call any of them.

profile: `bool` = (source)

`True` to run the tests with a profiler enabled.

reporterFactory: `Callable[[TextIO, str, bool, log.LogPublisher], itrial.IReporter]` = (source)

A callable to create a reporter to use.

stream: `TextIO` = (source)

The file to report results to.

uncleanWarnings: `bool` = (source)

`True` to report dirty reactor errors as warnings, `False` to report them as test-failing errors.

workingDirectory: `str` = (source)

A path template to a directory which will be the process's working directory while the tests are running.

@property
rterrors: `bool` = (source)

Undocumented

@property
tbformat: `str` = (source)

Undocumented

def _makeResult(self) -> `itrial.IReporter`: (source)

Undocumented

def _runWithoutDecoration(self, test: `pyunit.TestCase | pyunit.TestSuite`, forceGarbageCollection: `bool` = False) -> `itrial.IReporter`: (source)

Private helper that runs the given test but doesn't decorate it.

_exitFirst: `bool` = (source)

`True` to stop after the first failed test. `False` to run the whole suite.

_forceGarbageCollection: `bool` = (source)

`True` to perform a full garbage collection at least after each test. `False` to let garbage collection run only when it normally would.

_realTimeErrors: `bool` = (source)

`True` if errors should be reported as they happen. `False` if they should only be reported at the end of the test run in the summary.

_tracebackFormat: `str` = (source)

A format name to use with `Failure` for reporting failures.