本文整理汇总了Python中unittest.TestCase.run方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.run方法的具体用法?Python TestCase.run怎么用?Python TestCase.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.run方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result=None):
log.test("#" * 50) #Venkat
python_version=pexpect.run('python -V') #Venkat
log.test("Python Version: %s" % python_version.strip())#Venkat
log.test("#" * 50) #Venkat
log.test("#" * 50)
log.test(self._testMethodName)
log.test("#" * 50)
TestCase.run(self, result)
示例2: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result=None):
BaseTestCase.run(self, result)
if result is not None:
errors = result.errors
skip_error = (
'in skipTest\n raise SkipException(msg)')
result.errors = []
for error in errors:
if skip_error in error[1]:
print ('Skipped')
else:
result.errors.append(error)
return result
示例3: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result):
"""
Call the parent run() for each backend instance.
Skip the test if we have no backends.
"""
try:
if not len(self.backends):
result.startTest(self)
result.stopTest(self)
raise SkipTest('No backends configured for this module.')
TestCase.run(self, result)
finally:
self.weboob.deinit()
示例4: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result):
"""
Call the parent run() for each backend instance.
Skip the test if we have no backends.
"""
# This is a hack to fix an issue with nosetests running
# with many tests. The default is 1000.
sys.setrecursionlimit(10000)
try:
if not len(self.backends):
result.startTest(self)
result.stopTest(self)
raise SkipTest('No backends configured for this module.')
TestCase.run(self, result)
finally:
self.weboob.deinit()
示例5: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result):
if not self.backend:
result.startTest(self)
result.stopTest(self)
raise SkipTest()
return TestCase.run(self, result)
示例6: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result):
"""
Call the parent run() for each backend instance.
Skip the test if we have no backends.
"""
# This is a hack to fix an issue with nosetests running
# with many tests. The default is 1000.
sys.setrecursionlimit(10000)
try:
if not len(self.backends):
self.backend = self.weboob.build_backend(self.MODULE, nofail=True)
TestCase.run(self, result)
else:
# Run for all backend
for backend_instance in self.backends.keys():
print(backend_instance)
self.backend = self.backends[backend_instance]
TestCase.run(self, result)
finally:
self.weboob.deinit()
示例7: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result=None):
testMethod = getattr(self, self._testMethodName);
# gets the data provider method name
try:
providerName = getattr(testMethod, self.ATTR_METHOD_NAME);
except AttributeError:
return BaseTestCase.run(self, result);
# call the data provider method for gets all datasets
datas = getattr(self, providerName)();
# runs the test with all datasets
for dataId in range(len(datas)):
# use the same behavior than the `TestSuite.run` method
if result and result.shouldStop:
break;
# create a clone of the current instance with this data set
that = type(self)(self._testMethodName, datas[dataId], dataId);
BaseTestCase.run(that, result);
示例8: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result=None):
"""Runs the test.
@param result: TestResult
"""
assert None is result or isinstance(result, TestResult);
if None is result :
result = self.defaultTestResult();
if not isinstance(result, _TestResultWrapper) :
result = _TestResultWrapper(result);
return BaseTestCase.run(self, result);
示例9: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, *pos, **kw):
import socket as socketmod
def socket(*pos, **kw):
raise self.DirectSocket("socket.socket() called")
with substattr(socketmod, socket):
return TestCase.run(self, *pos, **kw)
示例10: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, *args, **kwargs):
if self.switch_expected == 'default':
self.switch_expected = get_switch_expected(self.fullname)
return BaseTestCase.run(self, *args, **kwargs)
示例11: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self):
print("Running python tests")
print("LEDs Tests")
TestCase.run(TestLeds())
print("____________________")
print("Switches Tests")
TestCase.run(TestSwitches())
print("____________________")
print("UART Tests")
TestCase.run(TestUart())
print("____________________")
print("EEPROM Tests")
TestCase.run(TestEEPROM())
print("____________________")
print("DAC Tests")
TestCase.run(TestDAC())
print("____________________")
print("ADC Tests")
TestCase.run(TestADC())
print("____________________")
print("GPIOs Tests")
TestCase.run(TestGPIO())
print("____________________")
print("RS485 Tests")
TestCase.run(TestRS485())
print("____________________")
print("Timers Tests")
TestCase.run(TestTimers())
print("____________________")
print("Statistics:")
TestCase.printStatistics()
示例12: run
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import run [as 别名]
def run(self, result=None):
with StackContext(self._cleanup):
TestCase.run(self, result)