本文整理汇总了Python中unittest.findTestCases方法的典型用法代码示例。如果您正苦于以下问题:Python unittest.findTestCases方法的具体用法?Python unittest.findTestCases怎么用?Python unittest.findTestCases使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest
的用法示例。
在下文中一共展示了unittest.findTestCases方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
suite = unittest.TestSuite()
for cls in classes:
if isinstance(cls, str):
if cls in sys.modules:
suite.addTest(unittest.findTestCases(sys.modules[cls]))
else:
raise ValueError("str arguments must be keys in sys.modules")
elif isinstance(cls, valid_types):
suite.addTest(cls)
else:
suite.addTest(unittest.makeSuite(cls))
_filter_suite(suite, match_test)
_run_suite(suite)
#=======================================================================
# Check for the presence of docstrings.
示例2: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
suite = unittest.TestSuite()
for cls in classes:
if isinstance(cls, str):
if cls in sys.modules:
suite.addTest(unittest.findTestCases(sys.modules[cls]))
else:
raise ValueError("str arguments must be keys in sys.modules")
elif isinstance(cls, valid_types):
suite.addTest(cls)
else:
suite.addTest(unittest.makeSuite(cls))
_run_suite(suite)
#=======================================================================
# Check for the presence of docstrings.
示例3: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def suite():
modules_to_test = (
'testcase_ATR',
'testcase_Card',
'testcase_CardConnection',
'testcase_CardMonitor',
'testcase_CardRequest',
'testcase_CardService',
'testcase_CardType',
'testcase_CAtr',
'testcase_ErrorChecking',
'testcase_ExclusiveCardConnection',
'testcase_readers',
'testcase_readergroups',
'testcase_readermonitor',
'testcase_readermonitorstress',
'testcase_ulist',
'testcase_utils',
)
testsuite_framework = unittest.TestSuite()
for module in map(__import__, modules_to_test):
testsuite_framework.addTest(unittest.findTestCases(module))
return testsuite_framework
示例4: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
suite = unittest.TestSuite()
for cls in classes:
if isinstance(cls, str):
if cls in sys.modules:
suite.addTest(unittest.findTestCases(sys.modules[cls]))
else:
raise ValueError("str arguments must be keys in sys.modules")
elif isinstance(cls, valid_types):
suite.addTest(cls)
else:
suite.addTest(unittest.makeSuite(cls))
_filter_suite(suite, _match_test)
_run_suite(suite)
#=======================================================================
# Check for the presence of docstrings.
# Rather than trying to enumerate all the cases where docstrings may be
# disabled, we just check for that directly
示例5: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
suite = unittest.TestSuite()
for cls in classes:
if isinstance(cls, str):
if cls in sys.modules:
suite.addTest(unittest.findTestCases(sys.modules[cls]))
else:
raise ValueError("str arguments must be keys in sys.modules")
elif isinstance(cls, valid_types):
suite.addTest(cls)
else:
suite.addTest(unittest.makeSuite(cls))
def case_pred(test):
if match_tests is None:
return True
for name in test.id().split("."):
if fnmatch.fnmatchcase(name, match_tests):
return True
return False
_filter_suite(suite, case_pred)
_run_suite(suite)
#=======================================================================
# Check for the presence of docstrings.
示例6: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
suite = unittest.TestSuite()
for cls in classes:
if isinstance(cls, str):
if cls in sys.modules:
suite.addTest(unittest.findTestCases(sys.modules[cls]))
else:
raise ValueError("str arguments must be keys in sys.modules")
elif isinstance(cls, valid_types):
suite.addTest(cls)
else:
suite.addTest(unittest.makeSuite(cls))
def case_pred(test):
if match_tests is None:
return True
for name in test.id().split("."):
if fnmatch.fnmatchcase(name, match_tests):
return True
return False
_filter_suite(suite, case_pred)
_run_suite(suite)
# We don't have sysconfig on Py2.6:
# #=======================================================================
# # Check for the presence of docstrings.
#
# HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or
# sys.platform == 'win32' or
# sysconfig.get_config_var('WITH_DOC_STRINGS'))
#
# requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
# "test requires docstrings")
#
#
# #=======================================================================
# doctest driver.
示例7: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def suite():
modules_to_test = (
'testcase_getatr',
'testcase_getattrib',
'testcase_geterrormessage',
'testcase_listcards',
'testcase_locatecards',
'testcase_readergroups',
'testcase_returncodes',
'testcase_transaction')
testsuite_scard = unittest.TestSuite()
for module in map(__import__, modules_to_test):
testsuite_scard.addTest(unittest.findTestCases(module))
return testsuite_scard
示例8: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def suite():
modules_to_test = (
'testcase_pcscreadergroups',
)
testsuite_framework = unittest.TestSuite()
for module in map(__import__, modules_to_test):
testsuite_framework.addTest(unittest.findTestCases(module))
return testsuite_framework
示例9: test_suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def test_suite():
return unittest.findTestCases(sys.modules[__name__])