Python unittest.makeSuite() Examples

The following are 30 code examples for showing how to use unittest.makeSuite(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module unittest , or try the search function .

Example 1
Project: pywren-ibm-cloud   Author: pywren   File: tests.py    License: Apache License 2.0 7 votes vote down vote up
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) 
Example 2
Project: pandoc-xnos   Author: tomduck   File: test.py    License: GNU General Public License v3.0 6 votes vote down vote up
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) 
Example 3
Project: ironpython2   Author: IronLanguages   File: test_associate.py    License: Apache License 2.0 6 votes vote down vote up
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 
Example 4
Project: ironpython2   Author: IronLanguages   File: test_thread.py    License: Apache License 2.0 6 votes vote down vote up
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 
Example 5
Project: ironpython2   Author: IronLanguages   File: test_replication.py    License: Apache License 2.0 6 votes vote down vote up
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 
Example 6
Project: pylint-flask   Author: jschaf   File: test_func.py    License: GNU General Public License v2.0 5 votes vote down vote up
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]) 
Example 7
Project: jawfish   Author: war-and-code   File: support.py    License: MIT License 5 votes vote down vote up
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. 
Example 8
Project: razzy-spinner   Author: rafasashi   File: featurestructure.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testsuite():
    t1 = unittest.makeSuite(FeatureStructureTestCase)
    return unittest.TestSuite( (t1,) ) 
Example 9
Project: razzy-spinner   Author: rafasashi   File: evaluate.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testsuite():
    suite = unittest.makeSuite(TestModels)
    return unittest.TestSuite(suite) 
Example 10
Project: verge3d-blender-addon   Author: Soft8Soft   File: support.py    License: GNU General Public License v3.0 5 votes vote down vote up
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. 
Example 11
Project: rlite-py   Author: seppo0010   File: __init__.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 
Example 12
Project: pySmartDL   Author: iTaybb   File: test_pySmartDL.py    License: The Unlicense 5 votes vote down vote up
def test_suite():
    suite = unittest.makeSuite(TestSmartDL)
    return suite 
Example 13
Project: jbox   Author: jpush   File: tests.py    License: MIT License 5 votes vote down vote up
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 
Example 14
Project: vsphere-storage-for-docker   Author: vmware-archive   File: transactions.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    default_suite = unittest.makeSuite(TransactionTests, "Check")
    special_command_suite = unittest.makeSuite(SpecialCommandTests, "Check")
    return unittest.TestSuite((default_suite, special_command_suite)) 
Example 15
Project: vsphere-storage-for-docker   Author: vmware-archive   File: dbapi.py    License: Apache License 2.0 5 votes vote down vote up
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)) 
Example 16
Project: vsphere-storage-for-docker   Author: vmware-archive   File: hooks.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    collation_suite = unittest.makeSuite(CollationTests, "Check")
    progress_suite = unittest.makeSuite(ProgressTests, "Check")
    return unittest.TestSuite((collation_suite, progress_suite)) 
Example 17
Project: vsphere-storage-for-docker   Author: vmware-archive   File: userfunctions.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    function_suite = unittest.makeSuite(FunctionTests, "Check")
    aggregate_suite = unittest.makeSuite(AggregateTests, "Check")
    authorizer_suite = unittest.makeSuite(AuthorizerTests)
    return unittest.TestSuite((
            function_suite,
            aggregate_suite,
            authorizer_suite,
            unittest.makeSuite(AuthorizerRaiseExceptionTests),
            unittest.makeSuite(AuthorizerIllegalTypeTests),
            unittest.makeSuite(AuthorizerLargeIntegerTests),
        )) 
Example 18
Project: vsphere-storage-for-docker   Author: vmware-archive   File: regression.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    regression_suite = unittest.makeSuite(RegressionTests, "Check")
    return unittest.TestSuite((regression_suite,)) 
Example 19
Project: vsphere-storage-for-docker   Author: vmware-archive   File: py25tests.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    ctx_suite = unittest.makeSuite(ContextTests, "Check")
    return unittest.TestSuite((ctx_suite,)) 
Example 20
Project: vsphere-storage-for-docker   Author: vmware-archive   File: types.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    sqlite_type_suite = unittest.makeSuite(SqliteTypeTests, "Check")
    decltypes_type_suite = unittest.makeSuite(DeclTypesTests, "Check")
    colnames_type_suite = unittest.makeSuite(ColNamesTests, "Check")
    adaptation_suite = unittest.makeSuite(ObjectAdaptationTests, "Check")
    bin_suite = unittest.makeSuite(BinaryConverterTests, "Check")
    date_suite = unittest.makeSuite(DateTimeTests, "Check")
    return unittest.TestSuite((sqlite_type_suite, decltypes_type_suite, colnames_type_suite, adaptation_suite, bin_suite, date_suite)) 
Example 21
Project: NXP-MCUBootFlasher   Author: JayHeng   File: misc.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    argSuite = unittest.makeSuite(mymkargUnitTest)
    pathListSuite = unittest.makeSuite(FindPathListCommonPrefixUnitTest)
    rebuildSuite = unittest.makeSuite(rebuildPathSimpleUnitTest)
    hyphenSuite = unittest.makeSuite(onlyHyphensPleaseUnitTest)
    suite = unittest.TestSuite()
    suite.addTests((argSuite, pathListSuite, rebuildSuite, hyphenSuite))
    return suite

# Run unit tests when this source file is executed directly from the command
# line. 
Example 22
Project: NXP-MCUBootFlasher   Author: JayHeng   File: filetools.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
	suite = unittest.makeSuite(CopyFileUnitTest)
	return suite 
Example 23
Project: pledgeservice   Author: MayOneUS   File: test_bdist_egg.py    License: Apache License 2.0 5 votes vote down vote up
def test_suite():
    return unittest.makeSuite(TestDevelopTest) 
Example 24
Project: ironpython2   Author: IronLanguages   File: test_email_torture.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    suite = unittest.TestSuite()
    for testclass in _testclasses():
        suite.addTest(unittest.makeSuite(testclass))
    return suite 
Example 25
Project: ironpython2   Author: IronLanguages   File: test_email.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    suite = unittest.TestSuite()
    for testclass in _testclasses():
        suite.addTest(unittest.makeSuite(testclass))
    return suite 
Example 26
Project: ironpython2   Author: IronLanguages   File: test_email_renamed.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    suite = unittest.TestSuite()
    for testclass in _testclasses():
        suite.addTest(unittest.makeSuite(testclass))
    return suite 
Example 27
Project: ironpython2   Author: IronLanguages   File: test_email_codecs.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestEmailAsianCodecs))
    return suite 
Example 28
Project: ironpython2   Author: IronLanguages   File: test_email_codecs_renamed.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestEmailAsianCodecs))
    return suite 
Example 29
Project: ironpython2   Author: IronLanguages   File: dbapi.py    License: Apache License 2.0 5 votes vote down vote up
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)) 
Example 30
Project: ironpython2   Author: IronLanguages   File: hooks.py    License: Apache License 2.0 5 votes vote down vote up
def suite():
    collation_suite = unittest.makeSuite(CollationTests, "Check")
    progress_suite = unittest.makeSuite(ProgressTests, "Check")
    return unittest.TestSuite((collation_suite, progress_suite))