当前位置: 首页>>代码示例>>Python>>正文


Python util.excInfoOrFailureToExcInfo函数代码示例

本文整理汇总了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))
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:7,代码来源:test_util.py

示例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))
开发者ID:samsoft00,项目名称:careervacancy,代码行数:9,代码来源:reporter.py

示例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)
开发者ID:shelmesky,项目名称:twisted,代码行数:10,代码来源:runner.py

示例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)
开发者ID:antong,项目名称:twisted,代码行数:10,代码来源:runner.py

示例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))
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:11,代码来源:test_util.py

示例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)
开发者ID:hensing,项目名称:twisted,代码行数:13,代码来源:reporter.py

示例7: _exc_info

 def _exc_info(self, err):
     return util.excInfoOrFailureToExcInfo(err)
开发者ID:Architektor,项目名称:PySnip,代码行数:2,代码来源:_synctest.py


注:本文中的twisted.trial.util.excInfoOrFailureToExcInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。