本文整理汇总了Python中unittest.TestResult.addSuccess方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.addSuccess方法的具体用法?Python TestResult.addSuccess怎么用?Python TestResult.addSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestResult
的用法示例。
在下文中一共展示了TestResult.addSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _testrun
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [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
示例2: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
"Called when a test has completed successfully"
TestResult.addSuccess(self, test)
if self.verbose:
self.stream.write('ok\n')
else:
self.stream.write('.')
self.stream.flush()
示例3: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
self.success_count += 1
TestResult.addSuccess(self, test)
output = self.complete_output()
self.result.append((0, test, output, ""))
if self.verbosity > 1:
sys.stderr.write("ok ")
sys.stderr.write(str(test))
sys.stderr.write("\n")
else:
sys.stderr.write(".")
示例4: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
if self.showAll:
self.stream.writeln("ok")
elif self.dots:
context = get_context(test)
if context:
self.stream.writeln("")
self.stream.writeln(context)
self.stream.write('.')
self.stream.flush()
示例5: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
"""When a successful result is written in the superclass, it's result
is described as ok. Here we're altering it to write out 'PASS'.
"""
TestResult.addSuccess(self, test)
if self.showAll:
self.stream.writeln("PASS")
elif self.dots:
self.stream.write('.')
log.result("#" * 50)
log.result("%s: PASS" % test._testMethodName)
print "%s: PASS" % test._testMethodName
log.result("#" * 50)
示例6: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
if self.showAll:
self.stream.writeln("ok")
elif self.dots:
context = get_context(test)
if context:
self.stream.writeln("")
context_descriptor = self.getDescription(test)
this_file = context_descriptor.split(':')[0]
this_class = context_descriptor.split(":")[1].split(".")[0]
self.stream.writeln(this_file + ':' + this_class)
self.stream.write('.')
self.stream.flush()
示例7: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
if self.showAll:
self.stream.writeln(self.ok_string)
elif self.dots:
self.stream.write('.')
示例8: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
self.addAResult(test, SUCCESS, 'SUCCESS')
示例9: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
self._lastWas = 'success'
示例10: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test, *k):
TestResult.addSuccess(self, test)
self.output.write("ok\n")
示例11: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
if not self.iterations:
self.stream.write("ok\n")
示例12: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self,test):
TestResult.addSuccess(self, test)
self.logger.debug("PASS")
示例13: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
示例14: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
TestResult.addSuccess(self, test)
if self._logging:
self._writeToStream("\tResult: ")
self._writeToStream("OK", eColors.Green)
示例15: addSuccess
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import addSuccess [as 别名]
def addSuccess(self, test):
_TestResult.addSuccess(self, test)
filename = inspect.getfile(test.__class__)
testname = test._testMethodName
self.stream.writeln("TEST-PASS | {0} | {1}".format(filename, testname))