当前位置: 首页>>代码示例>>Python>>正文


Python unittest.findTestCases方法代码示例

本文整理汇总了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. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:__init__.py

示例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. 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:20,代码来源:test_support.py

示例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 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:25,代码来源:testsuite_framework.py

示例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 
开发者ID:ShikyoKira,项目名称:Project-New-Reign---Nemesis-Main,代码行数:24,代码来源:__init__.py

示例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. 
开发者ID:war-and-code,项目名称:jawfish,代码行数:28,代码来源:support.py

示例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. 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:40,代码来源:support.py

示例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 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:16,代码来源:testsuite_scard.py

示例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 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:10,代码来源:testsuite_frameworkpcsc.py

示例9: test_suite

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import findTestCases [as 别名]
def test_suite():
    return unittest.findTestCases(sys.modules[__name__]) 
开发者ID:julien6387,项目名称:supvisors,代码行数:4,代码来源:test_statscollector.py


注:本文中的unittest.findTestCases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。