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


Python TestResult.addFailure方法代码示例

本文整理汇总了Python中unittest.TestResult.addFailure方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.addFailure方法的具体用法?Python TestResult.addFailure怎么用?Python TestResult.addFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest.TestResult的用法示例。


在下文中一共展示了TestResult.addFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
    def addFailure(self, test, err, *k):
        TestResult.addFailure(self, test, err)

        err = self.formatErr(err)
        
        self.messages.testFailed(self.getTestName(test),
            message='Failure', details=err)
开发者ID:aaronb-inova,项目名称:teamcity-python,代码行数:9,代码来源:unittestpy.py

示例2: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
    def addFailure(self, test, err):
        location = self.init_suite(test)
        self.current_failed = True
        TestResult.addFailure(self, test, err)

        error_value = smart_str(err[1])
        if not len(error_value):
            # means it's test function and we have to extract value from traceback
            error_value = self.find_error_value(err[2])

        self_find_first = self.find_first(error_value)
        self_find_second = self.find_second(error_value)
        quotes = ["'", '"']
        if (
            self_find_first[0] == self_find_first[-1]
            and self_find_first[0] in quotes
            and self_find_second[0] == self_find_second[-1]
            and self_find_second[0] in quotes
        ):
            # let's unescape strings to show sexy multiline diff in PyCharm.
            # By default all caret return chars are escaped by testing framework
            first = self._unescape(self_find_first)
            second = self._unescape(self_find_second)
        else:
            first = second = ""
        err = self._exc_info_to_string(err, test)

        self.messages.testStarted(self.getTestName(test), location=location)
        duration = self.__getDuration(test)
        self.messages.testFailed(
            self.getTestName(test), message="Failure", details=err, expected=first, actual=second, duration=duration
        )
开发者ID:ashanco,项目名称:intellij-community,代码行数:34,代码来源:tcunittest.py

示例3: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self, test, err)
     if self.showAll:
         self.stream.writeln("FAIL")
     elif self.dots:
         self.printError('FAIL', err, test)
         self.stream.flush()
开发者ID:kmanalo,项目名称:nose-nicedots,代码行数:9,代码来源:plugin.py

示例4: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self, test, err)
     exctype, value, dummy_tb = err
     error_xml = self.xml.createElement('failure')
     error_xml.setAttribute('type', '%s' % exctype)
     message_xml = self.xml.createTextNode('%s' % value)
     error_xml.appendChild(message_xml)
     self._testcase_xml.appendChild(error_xml)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:10,代码来源:opus_test_runner.py

示例5: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self, test, err)
     if err[0] is KeyboardInterrupt:
         self.shouldStop = 1
     self._lastWas = 'failure'
     self._errorsAndFailures += '<failure type="%s">' % err[0].__name__
     for line in apply(traceback.format_exception, err):
        for l in string.split(line,"\n")[:-1]:
           self._errorsAndFailures += "%s" % l
     self._errorsAndFailures += "</failure>"
开发者ID:ask,项目名称:django-test-extensions,代码行数:12,代码来源:xmloutput.py

示例6: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     """
     Method called if a test failed.
     
     @param test Reference to the test object
     @param err The error traceback
     """
     TestResult.addFailure(self, test, err)
     tracebackLines = traceback.format_exception(*(err + (10,)))
     self.parent.write('{0}{1}\n'.format(ResponseUTTestFailed,
         str((str(test), tracebackLines))))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:13,代码来源:DCTestResult.py

示例7: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     self.failure_count += 1
     TestResult.addFailure(self, test, err)
     _exc_str = self.failures[-1][1]
     output = self.complete_output()
     self.result.append((1, test, output, _exc_str))
     if self.verbosity > 1:
         sys.stderr.write("F  ")
         sys.stderr.write(str(test))
         sys.stderr.write("\n")
     else:
         sys.stderr.write("F")
开发者ID:dash0002,项目名称:HTMLTestRunner,代码行数:14,代码来源:HTMLTestRunner.py

示例8: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     """
     Public method called if a test failed.
     
     @param test Reference to the test object
     @param err The error traceback
     """
     TestResult.addFailure(self, test, err)
     tracebackLines = self._exc_info_to_string(err, test)
     self.parent.write('{0}{1}\n'.format(
         ResponseUTTestFailed,
         str((str(test), tracebackLines, test.id()))))
开发者ID:paulmadore,项目名称:Eric-IDE,代码行数:14,代码来源:DCTestResult.py

示例9: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self,test, err)
     file_name =  getattr(self.stream,"name")
     if self.showAll:
         self.stream.writeln("FAIL")
     elif self.dots:
         self.stream.write('F')
     failure = TestResult._exc_info_to_string(self,err,test)
     log.result("#" * 50)
     log.result("%s: FAIL" % test._testMethodName)
     print "%s: FAIL" % test._testMethodName
     log.result("#" * 50)
     if "stdout" not in file_name:
             log.result("\n\n%s"%failure)
开发者ID:muttu2244,项目名称:MyPython,代码行数:16,代码来源:StokeTest.py

示例10: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
    def addFailure(self, test, err, *k):
        # workaround nose bug on python 3
        if _is_string(err[1]):
            err = (err[0], Exception(err[1]), err[2])

        TestResult.addFailure(self, test, err)

        err = self.formatErr(err)
        if self.getTestName(test) != self.test_name:
            sys.stderr.write("INTERNAL ERROR: addFailure(%s) outside of test\n" % self.getTestName(test))
            sys.stderr.write("Error: %s\n" % err)
            return

        self.messages.testFailed(self.getTestName(test),
                                 message='Failure', details=err)
开发者ID:curzona,项目名称:teamcity-python,代码行数:17,代码来源:unittestpy.py

示例11: _testrun

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
    def _testrun(self):
        """
        Start a Testrun and populate the Publishers

        @rtype: C{unittest.TestResult}
        @return: A TestResult 
        """    
        testrun_result = TestResult()
        try:
            publishers = self._publishers
            testrun = Testrun(self.is_hw_enabled,
                              self.is_host_enabled,
                              self.is_chroot_enabled)
            taskrunner = self.taskrunner

            #FIXME: Cheap hack to make testable
            testrun.run_test = taskrunner.run
            testrun_result.addSuccess(TestCase)if testrun.run() else \
                  testrun_result.addFailure(TestCase, (None, None, None))
        except Exception, err:
            er_type, value, traceback = sys.exc_info()
            LOG.error(str(value) or "Testrun Error", exc_info=err)
            publishers.set_exception(value)
            testrun_result.addError(TestCase, (er_type, value, traceback))
            if DEBUG:
                raise
开发者ID:mileskin,项目名称:ots-mirror,代码行数:28,代码来源:hub.py

示例12: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self, test, err)
     self._color_print("FAIL", RED)
开发者ID:giampaolo,项目名称:pyftpdlib,代码行数:5,代码来源:runner.py

示例13: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     UnitTestResult.addFailure(self, test, err)
     if self.showAll:
         self._errWrite('FAIL\n')
     elif self.dots:
         self._errWrite('F')
开发者ID:seecr,项目名称:meresco-triplestore,代码行数:8,代码来源:testrunner.py

示例14: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     _TestResult.addFailure(self, test, err)
     self.printFail(test,err)
     self.stream.writeln("FAIL: {0}".format(self.getDescription(test)))
     self.stream.writeln(self.failures[-1][1])
开发者ID:InternalError503,项目名称:cyberfox,代码行数:7,代码来源:mozunit.py

示例15: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addFailure [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self, test, err)
     if self.showAll:
         self.stream.write_message("FAIL")
     elif self.dots:
         self.stream.write_message('F')
开发者ID:jmahmood,项目名称:pytestsocket,代码行数:8,代码来源:wsunittest.py


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