本文整理汇总了Python中unittest.TestResult.startTest方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.startTest方法的具体用法?Python TestResult.startTest怎么用?Python TestResult.startTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestResult
的用法示例。
在下文中一共展示了TestResult.startTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
"Called before execute each test method."
self.start_time = time.time()
TestResult.startTest(self, test)
if self.showAll:
self.stream.write(' ' + self.getDescription(test))
self.stream.write(" ... ")
示例2: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
TestResult.startTest(self, test)
# just one buffer for both stdout and stderr
stdout_redirector.fp = self.outputBuffer
stderr_redirector.fp = self.outputBuffer
self.stdout0 = sys.stdout
self.stderr0 = sys.stderr
sys.stdout = stdout_redirector
sys.stderr = stderr_redirector
示例3: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
"""
Method called at the start of a test.
@param test Reference to the test object
"""
TestResult.startTest(self, test)
self.parent.write('{0}{1}\n'.format(ResponseUTStartTest,
str((str(test), test.shortDescription()))))
示例4: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
"""
Method called at the start of a test.
@param test Reference to the test object
"""
TestResult.startTest(self, test)
self.parent.write('%s%s\n' % (ResponseUTStartTest,
unicode((unicode(test), test.shortDescription()))))
示例5: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test): # CONSIDER why are there 2 startTests in here?
self._startTime = time.time()
test._extraXML = ''
test._extraAssertions = []
TestResult.startTest(self, test)
self.stream.write('<testcase classname="%s' % test.__class__.__name__ + '" name="%s' % test.id().split('.')[-1] + '"')
desc = test.shortDescription()
if desc:
desc = _cleanHTML(desc)
self.stream.write(' desc="%s"' % desc)
示例6: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test): # CONSIDER why are there 2 startTests in here?
self._startTime = time.time()
test._extraXML = ''
test._extraAssertions = []
TestResult.startTest(self, test)
self.stream.write('<testcase classname="%s' % test.__class__.__name__ + '" name="%s' % test.id().split('.')[-1] + '"')
desc = (test._testMethodDoc or '').strip()
# desc = test.shortDescription() # CONSIDER why did this fail?
if desc:
desc = _cleanHTML(desc)
desc = desc.replace('\n', ' ')
self.stream.write(' desc="%s"' % desc)
示例7: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
TestResult.startTest(self, test)
methodName = get_test_method_name(test)
methodClass = _strclass(test.__class__)
if methodClass not in self._testsuites:
self._testsuite = self.xml.createElement('testsuite')
self._testsuite.setAttribute('name', '%s' % methodClass)
self._testsuites[methodClass] = self._testsuite
self.xml.documentElement.appendChild(self._testsuite)
else:
self._testsuite = self._testsuites[methodClass]
self._testcase_xml = self.xml.createElement('testcase')
self._testcase_xml.setAttribute('name', '%s' % methodName)
self._startTime = time.time()
示例8: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
"Called when the given test is about to be run. Resets global flags."
self.last_errors.fill(False)
self.last_failed.fill(False)
TestResult.startTest(self, test)
示例9: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
self._startTime = time.time()
TestResult.startTest(self, test)
self.stream.write('<testcase classname="%s' % test.__class__.__name__ + '" name="%s' % test.id().split('.')[-1] + '"')
示例10: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
TestResult.startTest(self, test)
for listener in self.listeners:
listener.startTest(test)
示例11: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
test._subunit_started = True
#instead of calling TestProtocolClient.startTest(self, test),
#which uses test.id(), we follow what vanilla unittest does
self._stream.write("test: %s\n" % self.getDescription(test))
TestResult.startTest(self, test)
示例12: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
UnitTestResult.startTest(self, test)
if self.showAll:
self._errWrite(str(test))
self._errWrite(' ... ')
示例13: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
TestResult.startTest(self, test)
self._writeToStream("\t%s: " % test.id())
if self._logging:
self._writeToStream("\n")
示例14: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
"Called when the given test is about to be run"
TestResult.startTest(self, test)
if self.verbose:
self.stream.write(get_description(test))
self.stream.write(' ... ')
示例15: startTest
# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import startTest [as 别名]
def startTest(self, test):
TestResult.startTest(self, test)