Twisted Trial: Asynchronous unit testing framework.

Trial extends Python's builtin unittest to provide support for asynchronous tests.

Trial strives to be compatible with other Python xUnit testing frameworks. "Compatibility" is a difficult things to define. In practice, it means that:

  • twisted.trial.unittest.TestCase objects should be able to be used by other test runners without those runners requiring special support for Trial tests.
  • Tests that subclass the standard library TestCase and don't do anything "too weird" should be able to be discoverable and runnable by the Trial test runner without the authors of those tests having to jump through hoops.
  • Tests that implement the interface provided by the standard library TestCase should be runnable by the Trial runner.
  • The Trial test runner and Trial unittest.TestCase objects ought to be able to use standard library TestResult objects, and third party TestResult objects based on the standard library.

This list is not necessarily exhaustive -- compatibility is hard to define. Contributors who discover more helpful ways of defining compatibility are encouraged to update this document.

Examples:

Timeouts for tests should be implemented in the runner. If this is done, then timeouts could work for third-party TestCase objects as well as for twisted.trial.unittest.TestCase objects. Further, Twisted TestCase objects will run in other runners without timing out. See http://twistedmatrix.com/trac/ticket/2675.

Running tests in a temporary directory should be a feature of the test case, because often tests themselves rely on this behaviour. If the feature is implemented in the runner, then tests will change behaviour (possibly breaking) when run in a different test runner. Further, many tests don't even care about the filesystem. See http://twistedmatrix.com/trac/ticket/2916.

Module itrial Interfaces for Trial.
Module reporter Defines classes that handle the results of tests.
Module runner A miscellany of code used to run Trial tests.
Module unittest Things likely to be used by writers of unit tests.
Module util A collection of utility functions and classes, used internally by Trial.
Module _asyncrunner Infrastructure for test running and suites.
Module _asynctest Things likely to be used by writers of unit tests.
Package _dist This package implements the distributed Trial test runner:
Module _synctest Things likely to be used by writers of unit tests.
API Documentation for Twisted, generated by pydoctor at 2016-04-04 15:02:49.