本文整理汇总了Python中twisted.trial.util.excInfoOrFailureToExcInfo函数的典型用法代码示例。如果您正苦于以下问题:Python excInfoOrFailureToExcInfo函数的具体用法?Python excInfoOrFailureToExcInfo怎么用?Python excInfoOrFailureToExcInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了excInfoOrFailureToExcInfo函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_excInfo
def test_excInfo(self):
"""
L{excInfoOrFailureToExcInfo} returns exactly what it is passed, if it is
passed a tuple like the one returned by L{sys.exc_info}.
"""
info = (ValueError, ValueError("foo"), None)
self.assertTrue(info is excInfoOrFailureToExcInfo(info))
示例2: addFailure
def addFailure(self, test, err):
"""
Record that C{test} failed an assertion with the error C{err}.
Also marks the run as being unsuccessful, causing
L{SubunitReporter.wasSuccessful} to return C{False}.
"""
self._successful = False
return self._subunit.addFailure(test, util.excInfoOrFailureToExcInfo(err))
示例3: __init__
def __init__(self, description, error):
"""
@param description: A string used by C{TestResult}s to identify this
error. Generally, this is the name of a module that failed to import.
@param error: The error to be added to the result. Can be an `exc_info`
tuple or a L{twisted.python.failure.Failure}.
"""
super(ErrorHolder, self).__init__(description)
self.error = util.excInfoOrFailureToExcInfo(error)
示例4: run
def run(self, result):
"""
Run the test, reporting the error.
@param result: The C{TestResult} to store the results in.
@type result: L{twisted.trial.itrial.ITestResult}.
"""
result.startTest(self)
result.addError(self, util.excInfoOrFailureToExcInfo(self.error))
result.stopTest(self)
示例5: test_failure
def test_failure(self):
"""
When called with a L{Failure} instance, L{excInfoOrFailureToExcInfo}
returns a tuple like the one returned by L{sys.exc_info}, with the
elements taken from the type, value, and traceback of the failure.
"""
try:
1 / 0
except:
f = Failure()
self.assertEqual((f.type, f.value, f.tb), excInfoOrFailureToExcInfo(f))
示例6: addExpectedFailure
def addExpectedFailure(self, test, failure, todo):
"""
Record an expected failure from a test.
Some versions of subunit do not implement this. For those versions, we
record a success.
"""
failure = util.excInfoOrFailureToExcInfo(failure)
addExpectedFailure = getattr(self._subunit, 'addExpectedFailure', None)
if addExpectedFailure is None:
self.addSuccess(test)
else:
addExpectedFailure(test, failure)
示例7: _exc_info
def _exc_info(self, err):
return util.excInfoOrFailureToExcInfo(err)