Python unittest 模块,findTestCases() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用unittest.findTestCases()

项目:deb-python-functools32    作者:openstack    | 项目源码 | 文件源码
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)


#=======================================================================
# doctest driver.
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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.
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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.
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
    suite = unittest.TestSuite()
    for name in os.listdir(directory):
        if name.startswith(('.', '__')):
            continue
        path = os.path.join(directory, name)
        if (os.path.isfile(path) and name.startswith('test_') and
                name.endswith('.py')):
            submodule_name = os.path.splitext(name)[0]
            module_name = "{0}.{1}".format(package, submodule_name)
            __import__(module_name, level=0)
            module_tests = unittest.findTestCases(sys.modules[module_name])
            suite.addTest(module_tests)
        elif os.path.isdir(path):
            package_name = "{0}.{1}".format(package, name)
            __import__(package_name, level=0)
            package_tests = getattr(sys.modules[package_name], 'test_suite')()
            suite.addTest(package_tests)
        else:
            continue
    return suite
项目:pysimgrid    作者:alexmnazarenko    | 项目源码 | 文件源码
def collect_tests():
  tests = []
  for root, _, files in os.walk(TESTS_ROOT):
    for f in files:
      if TEST_MODULE_REGEX.match(f):
        test_file = os.path.join(root, f)
        module_name, _ = os.path.splitext(os.path.relpath(test_file, PROJECT_ROOT))
        module_name = module_name.replace("/", ".")
        module = __import__(module_name)
        for namepart in module_name.split(".")[1:]:
          module = getattr(module, namepart)
        for test_class in unittest.findTestCases(module)._tests:
          for test_function in test_class._tests:
            test_full_name = ".".join([module_name, type(test_function).__name__, test_function._testMethodName])
            tests.append((test_file, module_name, test_full_name))
  return tests
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
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))
    suite = filter_maybe(suite)
    _run_suite(suite)

#=======================================================================
# Check for the presence of docstrings.
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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.
项目:deb-python-lesscpy    作者:openstack    | 项目源码 | 文件源码
def find():
    svn = re.compile('\.svn')
    test = re.compile('test.+\.py$')
    alltests = unittest.TestSuite()
    for path, _, files in os.walk(here):
        if svn.search(path):
            continue
        for f in files:
            if test.search(f):
                module = __import__(f.split('.')[0])
                alltests.addTest(unittest.findTestCases(module))
    return alltests
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
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.
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:supvisors    作者:julien6387    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
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)


#=======================================================================
# doctest driver.
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
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.
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
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.
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
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.

# Rather than trying to enumerate all the cases where docstrings may be
# disabled, we just check for that directly
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
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.
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
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.
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
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.
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
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.

# Rather than trying to enumerate all the cases where docstrings may be
# disabled, we just check for that directly
项目:UMOG    作者:hsab    | 项目源码 | 文件源码
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.
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
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.
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
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.

# Rather than trying to enumerate all the cases where docstrings may be
# disabled, we just check for that directly
项目:beepboop    作者:nicolehe    | 项目源码 | 文件源码
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.
项目:geo-squizzy    作者:LowerSilesians    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])
项目:geo-squizzy    作者:LowerSilesians    | 项目源码 | 文件源码
def test_suite():
    return unittest.findTestCases(sys.modules[__name__])