本文整理汇总了Python中unittest.makeSuite方法的典型用法代码示例。如果您正苦于以下问题:Python unittest.makeSuite方法的具体用法?Python unittest.makeSuite怎么用?Python unittest.makeSuite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest
的用法示例。
在下文中一共展示了unittest.makeSuite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_tests
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def run_tests(test_to_run, config=None):
global CONFIG, STORAGE_CONFIG, STORAGE
CONFIG = json.load(args.config) if config else default_config()
STORAGE_CONFIG = extract_storage_config(CONFIG)
STORAGE = InternalStorage(STORAGE_CONFIG).storage_handler
suite = unittest.TestSuite()
if test_to_run == 'all':
suite.addTest(unittest.makeSuite(TestPywren))
else:
try:
suite.addTest(TestPywren(test_to_run))
except ValueError:
print("unknown test, use: --help")
sys.exit()
runner = unittest.TextTestRunner()
runner.run(suite)
示例2: main
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def main():
"""Runs the suite of unit tests"""
# Do the tests
suite = unittest.TestSuite()
suite.addTests(unittest.makeSuite(TestXnos))
suite.addTests(unittest.makeSuite(TestPandocAttributes))
result = unittest.TextTestRunner(verbosity=1).run(suite)
n_errors = len(result.errors)
n_failures = len(result.failures)
if n_errors or n_failures:
print('\n\nSummary: %d errors and %d failures reported\n'%\
(n_errors, n_failures))
print()
sys.exit(n_errors+n_failures)
示例3: test_suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(AssociateErrorTestCase))
suite.addTest(unittest.makeSuite(AssociateHashTestCase))
suite.addTest(unittest.makeSuite(AssociateBTreeTestCase))
suite.addTest(unittest.makeSuite(AssociateRecnoTestCase))
suite.addTest(unittest.makeSuite(AssociateBTreeTxnTestCase))
suite.addTest(unittest.makeSuite(ShelveAssociateHashTestCase))
suite.addTest(unittest.makeSuite(ShelveAssociateBTreeTestCase))
suite.addTest(unittest.makeSuite(ShelveAssociateRecnoTestCase))
if have_threads:
suite.addTest(unittest.makeSuite(ThreadedAssociateHashTestCase))
suite.addTest(unittest.makeSuite(ThreadedAssociateBTreeTestCase))
suite.addTest(unittest.makeSuite(ThreadedAssociateRecnoTestCase))
return suite
示例4: test_suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def test_suite():
suite = unittest.TestSuite()
if have_threads:
suite.addTest(unittest.makeSuite(BTreeConcurrentDataStore))
suite.addTest(unittest.makeSuite(HashConcurrentDataStore))
suite.addTest(unittest.makeSuite(BTreeSimpleThreaded))
suite.addTest(unittest.makeSuite(HashSimpleThreaded))
suite.addTest(unittest.makeSuite(BTreeThreadedTransactions))
suite.addTest(unittest.makeSuite(HashThreadedTransactions))
suite.addTest(unittest.makeSuite(BTreeThreadedNoWaitTransactions))
suite.addTest(unittest.makeSuite(HashThreadedNoWaitTransactions))
else:
print "Threads not available, skipping thread tests."
return suite
示例5: test_suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def test_suite():
suite = unittest.TestSuite()
if db.version() >= (4, 6) :
dbenv = db.DBEnv()
try :
dbenv.repmgr_get_ack_policy()
ReplicationManager_available=True
except :
ReplicationManager_available=False
dbenv.close()
del dbenv
if ReplicationManager_available :
suite.addTest(unittest.makeSuite(DBReplicationManager))
if have_threads :
suite.addTest(unittest.makeSuite(DBBaseReplication))
return suite
示例6: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def suite():
test_list = tests('input', 'messages')
if module_exists('rest_framework'):
test_list += tests('external_drf', '')
return unittest.TestSuite(
[unittest.makeSuite(test, suiteClass=unittest.TestSuite)
for test in test_list])
示例7: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [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.
示例8: testsuite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def testsuite():
t1 = unittest.makeSuite(FeatureStructureTestCase)
return unittest.TestSuite( (t1,) )
示例9: testsuite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def testsuite():
suite = unittest.makeSuite(TestModels)
return unittest.TestSuite(suite)
示例10: run_unittest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [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.
示例11: tests
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def tests():
from test import rlite, persistent
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(rlite.RliteTest))
suite.addTest(unittest.makeSuite(persistent.PersistentTest))
try:
from test import patch
suite.addTest(unittest.makeSuite(patch.PatchConnTest))
suite.addTest(unittest.makeSuite(patch.PatchContextManagerTest))
except ImportError:
pass
return suite
示例12: test_suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def test_suite():
suite = unittest.makeSuite(TestSmartDL)
return suite
示例13: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(MarkupTestCase))
# this test only tests the c extension
if not hasattr(escape, 'func_code'):
suite.addTest(unittest.makeSuite(MarkupLeakTestCase))
return suite
示例14: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def suite():
default_suite = unittest.makeSuite(TransactionTests, "Check")
special_command_suite = unittest.makeSuite(SpecialCommandTests, "Check")
return unittest.TestSuite((default_suite, special_command_suite))
示例15: suite
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import makeSuite [as 别名]
def suite():
module_suite = unittest.makeSuite(ModuleTests, "Check")
connection_suite = unittest.makeSuite(ConnectionTests, "Check")
cursor_suite = unittest.makeSuite(CursorTests, "Check")
thread_suite = unittest.makeSuite(ThreadTests, "Check")
constructor_suite = unittest.makeSuite(ConstructorTests, "Check")
ext_suite = unittest.makeSuite(ExtensionTests, "Check")
closed_con_suite = unittest.makeSuite(ClosedConTests, "Check")
closed_cur_suite = unittest.makeSuite(ClosedCurTests, "Check")
return unittest.TestSuite((module_suite, connection_suite, cursor_suite, thread_suite, constructor_suite, ext_suite, closed_con_suite, closed_cur_suite))