Merge pull request #1148 from cjwatson/8267-circular-reporter
Fix circular import in twisted.trial.reporter
This commit is contained in:
commit
a4c171b461
|
@ -0,0 +1 @@
|
|||
Fixed circular import in twisted.trial.reporter, introduced in Twisted 16.0.0.
|
|
@ -26,7 +26,6 @@ from twisted.python.failure import Failure
|
|||
from twisted.python.util import untilConcludes
|
||||
from twisted.python.compat import _PY3, items
|
||||
from twisted.trial import itrial, util
|
||||
from twisted.trial.unittest import makeTodo
|
||||
|
||||
try:
|
||||
from subunit import TestProtocolClient
|
||||
|
@ -35,6 +34,23 @@ except ImportError:
|
|||
|
||||
|
||||
|
||||
def _makeTodo(value):
|
||||
"""
|
||||
Return a L{Todo} object built from C{value}.
|
||||
|
||||
This is a synonym for L{twisted.trial.unittest.makeTodo}, but imported
|
||||
locally to avoid circular imports.
|
||||
|
||||
@param value: A string or a tuple of C{(errors, reason)}, where C{errors}
|
||||
is either a single exception class or an iterable of exception classes.
|
||||
|
||||
@return: A L{Todo} object.
|
||||
"""
|
||||
from twisted.trial.unittest import makeTodo
|
||||
return makeTodo(value)
|
||||
|
||||
|
||||
|
||||
class BrokenTestCaseWarning(Warning):
|
||||
"""
|
||||
Emitted as a warning when an exception occurs in one of setUp or tearDown.
|
||||
|
@ -170,7 +186,7 @@ class TestResult(pyunit.TestResult, object):
|
|||
message is provided.
|
||||
"""
|
||||
if todo is None:
|
||||
todo = makeTodo(self._DEFAULT_TODO)
|
||||
todo = _makeTodo(self._DEFAULT_TODO)
|
||||
self.unexpectedSuccesses.append((test, todo))
|
||||
|
||||
|
||||
|
@ -187,7 +203,7 @@ class TestResult(pyunit.TestResult, object):
|
|||
message is provided.
|
||||
"""
|
||||
if todo is None:
|
||||
todo = makeTodo(self._DEFAULT_TODO)
|
||||
todo = _makeTodo(self._DEFAULT_TODO)
|
||||
self.expectedFailures.append((test, error, todo))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue