Add support for "broken" Twisted-style tests.

Some tests leak resources.  Clean up after them.
This commit is contained in:
Jean-Paul Calderone 2019-03-07 18:55:52 -05:00
parent 4de7077689
commit 925a3aed7b

View File

@ -12,8 +12,9 @@ from testtools import (
TestCase,
)
from testtools.twistedsupport import (
AsynchronousDeferredRunTest,
SynchronousDeferredRunTest,
AsynchronousDeferredRunTest,
AsynchronousDeferredRunTestForBrokenTwisted,
)
from twisted.internet import defer
@ -892,3 +893,16 @@ class AsyncTestCase(_TestCaseMixin, TestCase):
AsynchronousDeferredRunTest.make_factory(timeout=60.0),
)
class AsyncBrokenTestCase(_TestCaseMixin, TestCase):
"""
A ``TestCase`` like ``AsyncTestCase`` but which spins the reactor a little
longer than apparently necessary to clean out lingering unaccounted for
event sources.
Tests which require this behavior are broken and should be fixed so they
pass with ``AsyncTestCase``.
"""
run_tests_with = EliotLoggedRunTest.make_factory(
AsynchronousDeferredRunTestForBrokenTwisted.make_factory(timeout=60.0),
)