本文整理汇总了Python中unittest.TestLoader.loadTestsFromNames方法的典型用法代码示例。如果您正苦于以下问题:Python TestLoader.loadTestsFromNames方法的具体用法?Python TestLoader.loadTestsFromNames怎么用?Python TestLoader.loadTestsFromNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestLoader
的用法示例。
在下文中一共展示了TestLoader.loadTestsFromNames方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_tests
# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromNames [as 别名]
def load_tests():
loader = TestLoader()
loader.suiteClass = OptionAwareTestLoader
for package in test_packages:
# forcing the improt now gives us better error messages sometimes
__import__(package)
tests = loader.loadTestsFromNames(test_packages)
return tests
示例2: test_suite
# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromNames [as 别名]
def test_suite():
names = [
'utils',
]
module_names = ['wafsamba.tests.test_' + name for name in names]
loader = TestLoader()
result = loader.suiteClass()
suite = loader.loadTestsFromNames(module_names)
result.addTests(suite)
return result
示例3: load_tests
# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromNames [as 别名]
def load_tests():
'''
@summary: 根据全局变量test_cases来装载测试用例
@return: 返回测试套件
'''
suite = TestSuite()
loader = TestLoader()
tests = loader.loadTestsFromNames(test_cases)
suite.addTests(tests)
return suite
示例4: run
# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromNames [as 别名]
def run(self):
pynames = tuple(self._pynames_iter())
# Add unit-tests:
loader = TestLoader()
suite = loader.loadTestsFromNames(pynames)
# FIXME ADD doctests
# Run the tests:
runner = TextTestRunner(verbosity=2)
result = runner.run(suite)
if not result.wasSuccessful():
raise SystemExit(1)
示例5: run
# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromNames [as 别名]
def run(self):
pynames = ["test"]
# Add unit-tests:
loader = TestLoader()
suite = loader.loadTestsFromNames(pynames)
# Add doc-tests:
for name in pynames:
suite.addTest(DocTestSuite(name))
# Run the tests:
runner = TextTestRunner(verbosity=2)
result = runner.run(suite)
if not result.wasSuccessful():
raise SystemExit(2)