當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。