l.t.ZopeTestInSubProcess : class documentation

Part of lp.testing View In Hierarchy

Known subclasses: lp.bugs.scripts.checkwatches.tests.test_core.TestTwistedThreadScheduler, lp.bugs.scripts.checkwatches.tests.test_core.TestTwistedThreadSchedulerInPlace, lp.services.job.tests.test_runner.TestTwistedJobRunner, lp.testing.tests.test_zope_test_in_subprocess.TestZopeTestInSubProcess

Run tests in a sub-process, respecting Zope idiosyncrasies.

Use this as a mixin with an interesting TestCase to isolate tests with side-effects. Each and every test method in the test case is run in a new, forked, sub-process. This will slow down your tests, so use it sparingly. However, when you need to, for example, start the Twisted reactor (which cannot currently be safely stopped and restarted in process) it is invaluable.

This is basically a reimplementation of subunit's IsolatedTestCase or IsolatedTestSuite, but adjusted to work with Zope. In particular, Zope's TestResult object is responsible for calling testSetUp() and testTearDown() on the selected layer.

Method run Undocumented
def run(self, result):
API Documentation for Launchpad, generated by pydoctor at 2020-01-21 00:00:12.