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

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

项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
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
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    setup_path()
    suite = unittest.TestSuite()
    try:
        from minitwit_tests import MiniTwitTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(MiniTwitTestCase))
    try:
        from flaskr_tests import FlaskrTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(FlaskrTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    setup_path()
    suite = unittest.TestSuite()
    try:
        from minitwit_tests import MiniTwitTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(MiniTwitTestCase))
    try:
        from flaskr_tests import FlaskrTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(FlaskrTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(ExtImportHookTestCase))
    return suite
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_suite():
    from zope.testing import doctest
    suite = unittest.makeSuite(InterfaceTests)
    suite.addTest(doctest.DocTestSuite("zope.interface.interface"))
    if sys.version_info >= (2, 4):
        suite.addTest(doctest.DocTestSuite())
    suite.addTest(doctest.DocFileSuite(
        '../README.txt',
        globs={'__name__': '__main__'},
        optionflags=doctest.NORMALIZE_WHITESPACE,
        ))
    suite.addTest(doctest.DocFileSuite(
        '../README.ru.txt',
        globs={'__name__': '__main__'},
        optionflags=doctest.NORMALIZE_WHITESPACE,
        ))
    return suite
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
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
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_suite():
    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(VersionTestCase))
    suite.addTest(unittest.makeSuite(BasicBTreeTestCase))
    suite.addTest(unittest.makeSuite(BasicHashTestCase))
    suite.addTest(unittest.makeSuite(BasicBTreeWithThreadFlagTestCase))
    suite.addTest(unittest.makeSuite(BasicHashWithThreadFlagTestCase))
    suite.addTest(unittest.makeSuite(BasicBTreeWithEnvTestCase))
    suite.addTest(unittest.makeSuite(BasicHashWithEnvTestCase))
    suite.addTest(unittest.makeSuite(BTreeTransactionTestCase))
    suite.addTest(unittest.makeSuite(HashTransactionTestCase))
    suite.addTest(unittest.makeSuite(BTreeRecnoTestCase))
    suite.addTest(unittest.makeSuite(BTreeRecnoWithThreadFlagTestCase))
    suite.addTest(unittest.makeSuite(BTreeDUPTestCase))
    suite.addTest(unittest.makeSuite(HashDUPTestCase))
    suite.addTest(unittest.makeSuite(BTreeDUPWithThreadTestCase))
    suite.addTest(unittest.makeSuite(HashDUPWithThreadTestCase))
    suite.addTest(unittest.makeSuite(BTreeMultiDBTestCase))
    suite.addTest(unittest.makeSuite(HashMultiDBTestCase))
    suite.addTest(unittest.makeSuite(DBEnvPrivateObject))
    suite.addTest(unittest.makeSuite(DBPrivateObject))
    suite.addTest(unittest.makeSuite(CrashAndBurn))

    return suite
项目: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.
项目:Texty    作者:sarthfrey    | 项目源码 | 文件源码
def suite():
    setup_path()
    suite = unittest.TestSuite()
    try:
        from minitwit_tests import MiniTwitTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(MiniTwitTestCase))
    try:
        from flaskr_tests import FlaskrTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(FlaskrTestCase))
    return suite
项目:electrostatics    作者:tomduck    | 项目源码 | 文件源码
def main():
    """Runs the unit tests"""

    suite = unittest.TestSuite()

    suite.addTests(unittest.makeSuite(TestFunctions))
    suite.addTests(unittest.makeSuite(TestPointCharge))
    suite.addTests(unittest.makeSuite(TestLineCharge))
    suite.addTests(unittest.makeSuite(TestElectricField))
    suite.addTests(unittest.makeSuite(TestGaussianCircle))

    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)
项目:QuantLib-noBoost-SWIG    作者:haozhangphd    | 项目源码 | 文件源码
def test():
    import QuantLib
    print('testing QuantLib ' +  QuantLib.__version__)

    suite = unittest.TestSuite()

    suite.addTest(DateTest())
    suite.addTest(DayCountersTest())
    suite.addTest(unittest.makeSuite(InstrumentTest,'test'))
    suite.addTest(unittest.makeSuite(MarketElementTest,'test'))
    suite.addTest(unittest.makeSuite(IntegralTest,'test'))
    suite.addTest(Solver1DTest())
    suite.addTest(unittest.makeSuite(TermStructureTest,'test'))
    suite.addTest(unittest.makeSuite(FixedRateBondTest, 'test'))
    suite.addTest(unittest.makeSuite(FixedRateBondHelperTest, 'test'))
    suite.addTest(unittest.makeSuite(CmsTest, 'test'))
    suite.addTest(unittest.makeSuite(AssetSwapTest, 'test'))
    suite.addTest(unittest.makeSuite(CapFloorTest, 'test'))

    result = unittest.TextTestRunner(verbosity=2).run(suite)

    if not result.wasSuccessful:
        sys.exit(1)
项目:tesismometro    作者:joapaspe    | 项目源码 | 文件源码
def suite():
    setup_path()
    suite = unittest.TestSuite()
    try:
        from minitwit_tests import MiniTwitTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(MiniTwitTestCase))
    try:
        from flaskr_tests import FlaskrTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(FlaskrTestCase))
    return suite
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def suite():
    setup_path()
    suite = unittest.TestSuite()
    try:
        from minitwit_tests import MiniTwitTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(MiniTwitTestCase))
    try:
        from flaskr_tests import FlaskrTestCase
    except ImportError:
        pass
    else:
        suite.addTest(unittest.makeSuite(FlaskrTestCase))
    return suite
项目:Taigabot    作者:FrozenPigs    | 项目源码 | 文件源码
def buildtestsuite(recurse=True):
    from enchant.checker.tests import TestChecker
    from enchant.tokenize.tests import TestTokenization, TestFilters
    from enchant.tokenize.tests import TestTokenizeEN
    suite = unittest.TestSuite()
    if recurse:
        suite.addTest(unittest.makeSuite(TestInstallEnv))
        suite.addTest(unittest.makeSuite(TestPy2exe))
    suite.addTest(unittest.makeSuite(TestBroker))
    suite.addTest(unittest.makeSuite(TestDict))
    suite.addTest(unittest.makeSuite(TestPWL))
    suite.addTest(unittest.makeSuite(TestUtils))
    suite.addTest(unittest.makeSuite(TestDocStrings))
    suite.addTest(unittest.makeSuite(TestChecker))
    suite.addTest(unittest.makeSuite(TestTokenization))
    suite.addTest(unittest.makeSuite(TestTokenizeEN))
    suite.addTest(unittest.makeSuite(TestFilters))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
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
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    for testclass in _testclasses():
        suite.addTest(unittest.makeSuite(testclass))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestEmailAsianCodecs))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    for testclass in _testclasses():
        suite.addTest(unittest.makeSuite(testclass))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestEmailAsianCodecs))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(DeprecationsTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestToolsTestCase))
    suite.addTest(unittest.makeSuite(SubdomainTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if flask.json_available:
        suite.addTest(unittest.makeSuite(JSONTestCase))
    suite.addTest(unittest.makeSuite(SendfileTestCase))
    suite.addTest(unittest.makeSuite(LoggingTestCase))
    suite.addTest(unittest.makeSuite(NoImportsTestCase))
    suite.addTest(unittest.makeSuite(StreamingTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(ViewTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(BlueprintTestCase))
    suite.addTest(unittest.makeSuite(ModuleTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(BasicFunctionalityTestCase))
    suite.addTest(unittest.makeSuite(SubdomainTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TemplatingTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if flask.signals_available:
        suite.addTest(unittest.makeSuite(SignalsTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(RequestContextTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(FlaskSubclassingTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if os.environ.get('RUN_FLASK_MEMORY_TESTS') == '1':
        suite.addTest(unittest.makeSuite(MemoryTestCase))
    suite.addTest(unittest.makeSuite(ExceptionTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(ConfigTestCase))
    suite.addTest(unittest.makeSuite(InstanceTestCase))
    return suite
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def test_suite():
    return unittest.makeSuite(TestDevelopTest)
项目:s2g    作者:caesar0301    | 项目源码 | 文件源码
def suite():
    suites = [ShapeGraphCase, BonusCase]
    suite = unittest.TestSuite()
    for s in suites:
        suite.addTest(unittest.makeSuite(s))
    return suite
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
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
项目:zoocore    作者:dsparrow27    | 项目源码 | 文件源码
def getTests(filterApplication=""):
    root = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "libs"))

    suites = {}
    for root, dirs, files in os.walk(root):
        for file in files:
            if file.startswith("__") or file.endswith(".pyc") or not file.lower().startswith("test"):
                logger.debug("skipping file for testing {}".format(file))
                continue
            name = os.path.splitext(os.path.basename(os.path.join(root, file)))[0]

            try:
                module = imp.load_source(name, os.path.realpath(os.path.join(root, file)))
            except ImportError as e:
                logger.info("import failed for {}".format(file), exc_info=True)
                continue

            for member in inspect.getmembers(module, predicate=inspect.isclass):
                cl = member[1]
                try:
                    app = cl.application
                except AttributeError:
                    logger.debug("class not a test skipping :{}".format(cl))
                    continue
                if app in suites:
                    suites[app].addTest(unittest.makeSuite(cl))
                    continue
                if not filterApplication:
                    newSuite = unittest.makeSuite(cl)
                    suites[app] = newSuite
                elif app == filterApplication:
                    newSuite = unittest.makeSuite(cl)
                    suites[app] = newSuite
    return suites
项目:zanph    作者:zanph    | 项目源码 | 文件源码
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
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(DeprecationsTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestToolsTestCase))
    suite.addTest(unittest.makeSuite(SubdomainTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if flask.json_available:
        suite.addTest(unittest.makeSuite(JSONTestCase))
    suite.addTest(unittest.makeSuite(SendfileTestCase))
    suite.addTest(unittest.makeSuite(LoggingTestCase))
    suite.addTest(unittest.makeSuite(NoImportsTestCase))
    suite.addTest(unittest.makeSuite(StreamingTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(AppContextTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(BlueprintTestCase))
    suite.addTest(unittest.makeSuite(ModuleTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(BasicFunctionalityTestCase))
    suite.addTest(unittest.makeSuite(SubdomainTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TemplatingTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if flask.signals_available:
        suite.addTest(unittest.makeSuite(SignalsTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(FlaskSubclassingTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    if os.environ.get('RUN_FLASK_MEMORY_TESTS') == '1':
        suite.addTest(unittest.makeSuite(MemoryTestCase))
    suite.addTest(unittest.makeSuite(ExceptionTestCase))
    return suite
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(ConfigTestCase))
    suite.addTest(unittest.makeSuite(InstanceTestCase))
    return suite
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Test))
    suite.addTest(DocTestSuite("zope.interface.declarations"))
    suite.addTest(DocTestSuite())

    return suite
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_suite():
    return makeSuite(Test)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Test))
    return suite