Clean up errors.

This commit is contained in:
Jonathan Lange
2011-03-22 15:17:10 +00:00
parent aebd9af5d6
commit 36015c8ed0
6 changed files with 23 additions and 22 deletions

View File

@@ -215,9 +215,9 @@ class Spinner(object):
"""Clean up any junk in the reactor.
Will always iterate the reactor a number of times equal to
`Spinner._OBLIGATORY_REACTOR_ITERATIONS`. This is to work around bugs
in various Twisted APIs where a Deferred fires but still leaves work
(e.g. cancelling a call, actually closing a connection) for the
``Spinner._OBLIGATORY_REACTOR_ITERATIONS``. This is to work around
bugs in various Twisted APIs where a Deferred fires but still leaves
work (e.g. cancelling a call, actually closing a connection) for the
reactor to do.
"""
for i in range(self._OBLIGATORY_REACTOR_ITERATIONS):

View File

@@ -98,7 +98,7 @@ class AsynchronousDeferredRunTest(_DeferredRunTest):
:param case: The `TestCase` to run.
:param handlers: A list of exception handlers (ExceptionType, handler)
where 'handler' is a callable that takes a `TestCase`, a
`testtools.TestResult` and the exception raised.
``testtools.TestResult`` and the exception raised.
:param reactor: The Twisted reactor to use. If not given, we use the
default reactor.
:param timeout: The maximum time allowed for running a test. The
@@ -292,8 +292,9 @@ def assert_fails_with(d, *exc_types, **kwargs):
:param exc_types: The exception types that the Deferred is expected to
fail with.
:param failureException: An optional keyword argument. If provided, will
raise that exception instead of `testtools.TestCase.failureException`.
:return: A Deferred that will fail with an `AssertionError` if 'd' does
raise that exception instead of
``testtools.TestCase.failureException``.
:return: A Deferred that will fail with an ``AssertionError`` if 'd' does
not fail with one of the exception types.
"""
failureException = kwargs.pop('failureException', None)

View File

@@ -145,7 +145,7 @@ class RunTest(object):
See the docstring for addCleanup for more information.
:return: None if all cleanups ran without error,
`exception_caught` if there was an error.
``exception_caught`` if there was an error.
"""
failing = False
while self.case._cleanups:
@@ -162,7 +162,7 @@ class RunTest(object):
Exceptions are processed by `_got_user_exception`.
:return: Either whatever 'fn' returns or `exception_caught` if
:return: Either whatever 'fn' returns or ``exception_caught`` if
'fn' raised an exception.
"""
try:

View File

@@ -65,7 +65,7 @@ _ExpectedFailure = try_import(
def run_test_with(test_runner, **kwargs):
"""Decorate a test as using a specific `RunTest`.
"""Decorate a test as using a specific ``RunTest``.
e.g.
.. python::
@@ -75,16 +75,16 @@ def run_test_with(test_runner, **kwargs):
self.assertTrue(True)
The returned decorator works by setting an attribute on the decorated
function. `TestCase.__init__` looks for this attribute when deciding
on a `RunTest` factory. If you wish to use multiple decorators on a test
method, then you must either make this one the top-most decorator, or
you must write your decorators so that they update the wrapping function
with the attributes of the wrapped function. The latter is recommended
style anyway. 'functools.wraps', 'functools.wrapper' and
function. `TestCase.__init__` looks for this attribute when deciding on a
``RunTest`` factory. If you wish to use multiple decorators on a test
method, then you must either make this one the top-most decorator, or you
must write your decorators so that they update the wrapping function with
the attributes of the wrapped function. The latter is recommended style
anyway. 'functools.wraps', 'functools.wrapper' and
'twisted.python.util.mergeFunctionMetadata' can help you do this.
:param test_runner: A `RunTest` factory that takes a test case and an
optional list of exception handlers. See `RunTest`.
:param test_runner: A ``RunTest`` factory that takes a test case and an
optional list of exception handlers. See ``RunTest``.
:param kwargs: Keyword arguments to pass on as extra arguments to
'test_runner'.
:return: A decorator to be used for marking a test as needing a special
@@ -122,7 +122,7 @@ class TestCase(unittest.TestCase):
:keyword runTest: Optional class to use to execute the test. If not
supplied `RunTest` is used. The instance to be used is created
when run() is invoked, so will be fresh each time. Overrides
`TestCase.run_tests_with` if given.
``TestCase.run_tests_with`` if given.
"""
runTest = kwargs.pop('runTest', None)
unittest.TestCase.__init__(self, *args, **kwargs)

View File

@@ -277,7 +277,7 @@ class TestAdaptedPython27TestResultContract(TestCase, DetailsContract):
class TestTestResult(TestCase):
"""Tests for `TestResult`."""
"""Tests for 'TestResult'."""
def makeResult(self):
"""Make an arbitrary result for testing."""
@@ -339,7 +339,7 @@ class TestWithFakeExceptions(TestCase):
class TestMultiTestResult(TestWithFakeExceptions):
"""Tests for `MultiTestResult`."""
"""Tests for 'MultiTestResult'."""
def setUp(self):
TestWithFakeExceptions.setUp(self)
@@ -432,7 +432,7 @@ class TestMultiTestResult(TestWithFakeExceptions):
class TestTextTestResult(TestCase):
"""Tests for `TextTestResult`."""
"""Tests for 'TextTestResult'."""
def setUp(self):
super(TestTextTestResult, self).setUp()

View File

@@ -200,7 +200,7 @@ class TestErrorHolder(TestCase):
class TestEquality(TestCase):
"""Test `TestCase`'s equality implementation."""
"""Test ``TestCase``'s equality implementation."""
def test_identicalIsEqual(self):
# TestCase's are equal if they are identical.