当前位置: 首页>>代码示例>>Python>>正文


Python TestLoader.loadTestsFromTestCase方法代码示例

本文整理汇总了Python中unittest.TestLoader.loadTestsFromTestCase方法的典型用法代码示例。如果您正苦于以下问题:Python TestLoader.loadTestsFromTestCase方法的具体用法?Python TestLoader.loadTestsFromTestCase怎么用?Python TestLoader.loadTestsFromTestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest.TestLoader的用法示例。


在下文中一共展示了TestLoader.loadTestsFromTestCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_all

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def test_all():
    loader = TestLoader()
    suite = TestSuite()
    suite.addTests(loader.loadTestsFromTestCase(TestLocale))
    suite.addTests(loader.loadTestsFromTestCase(TestExtract))
    suite.addTests(loader.loadTestsFromTestCase(TestMerge))
    return suite
开发者ID:RTOSkit,项目名称:tornado-babel,代码行数:9,代码来源:__init__.py

示例2: run

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def run():
    loader = TestLoader()
    suite = TestSuite((
        loader.loadTestsFromTestCase(UtilsTests),
        loader.loadTestsFromTestCase(Tests)
    ))
    runner = TextTestRunner(verbosity = 2)
    runner.run(suite)
开发者ID:calebbarr,项目名称:imgurfavoritesrss,代码行数:10,代码来源:tests.py

示例3: loadTestCases

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
 def loadTestCases(self):
     loader = TestLoader()
     selector = QTestLoader()
     if selector.exec_():
         self.cases[:] = []
         for case in selector.selected:
             self.cases.extend(loader.loadTestsFromTestCase(case))
开发者ID:derdon,项目名称:qtestudo,代码行数:9,代码来源:qtestudo.py

示例4: TestGroup

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
class TestGroup(object):
    def __init__(self, name, classnames=None, groupSetUp=lambda:None, groupTearDown=lambda:None):
        self.name = name
        self._classes = {}
        for classname in (classnames or []):
            self._loadClass(classname)
        self._loader = TestLoader()
        self.setUp = groupSetUp
        self.tearDown = groupTearDown

    def _loadClass(self, classname):
        moduleName, className = classname.rsplit('.', 1)
        cls = getattr(__import__(moduleName, globals(), locals(), [className]), className)
        self._classes[className] = cls

    def createSuite(self, testnames=None):
        if not testnames:
            testnames = sorted(self._classes.keys())
        suite = TestSuite()
        for testname in testnames:
            testcase = testname.split('.')
            testclass = self._classes.get(testcase[0], None)
            if not testclass:
                continue
            if len(testcase) == 1:
                suite.addTest(self._loader.loadTestsFromTestCase(testclass))
            else:
                suite.addTest(self._loader.loadTestsFromName(testcase[1], testclass))
        return suite
开发者ID:seecr,项目名称:meresco-triplestore,代码行数:31,代码来源:testrunner.py

示例5: test_suite

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def test_suite():
    loader = TestLoader()
    tests = loader.loadTestsFromTestCase(PrincipalAnnotationTests)
    import zope.app.principalannotation

    tests.addTest(doctest.DocTestSuite(zope.app.principalannotation))
    return tests
开发者ID:wpjunior,项目名称:proled,代码行数:9,代码来源:tests.py

示例6: suite

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def suite():
    """Suite of TestCases for Django"""
    suite = TestSuite()
    loader = TestLoader()

    test_cases = (ManagersTestCase, EntryTestCase,
                  LoadModelClassTestCase, SignalsTestCase,
                  EntryHtmlContentTestCase, CategoryTestCase,
                  ZinniaViewsTestCase, ZinniaFeedsTestCase,
                  ZinniaSitemapsTestCase, ComparisonTestCase,
                  DirectoryPingerTestCase, ExternalUrlsPingerTestCase,
                  TemplateTagsTestCase, QuickEntryTestCase,
                  URLShortenerTestCase, EntryCommentModeratorTestCase,
                  ZinniaCustomDetailViews, SpamCheckerTestCase,
                  EntryAdminTestCase, CategoryAdminTestCase,
                  MixinTestCase, LongEnoughTestCase,
                  AuthorTestCase, FlagsTestCase,
                  AuthorListFilterTestCase, CategoryListFilterTestCase,
                  TranslatedURLsTestCase, EntryAbsoluteUrlTestCase,
                  MarkupsTestCase, FailImportMarkupTestCase,
                  PingBackTestCase, MetaWeblogTestCase,
                  HTMLPreviewTestCase,
                  EntryAdminFormTestCase, CategoryAdminFormTestCase,
                  MPTTModelChoiceIteratorTestCase,
                  MPTTModelMultipleChoiceFieldTestCase,
                  MPTTFilteredSelectMultipleTestCase
                  )

    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)

    return suite
开发者ID:nffdiogosilva,项目名称:django-blog-zinnia,代码行数:35,代码来源:__init__.py

示例7: suite

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def suite():
    """Suite of TestCases for Django"""
    suite = TestSuite()
    loader = TestLoader()

    test_cases = (ManagersTestCase, EntryTestCase,
                  EntryGetBaseModelTestCase, SignalsTestCase,
                  EntryHtmlContentTestCase, CategoryTestCase,
                  ZinniaViewsTestCase, ZinniaFeedsTestCase,
                  ZinniaSitemapsTestCase, ComparisonTestCase,
                  DirectoryPingerTestCase, ExternalUrlsPingerTestCase,
                  TemplateTagsTestCase, QuickEntryTestCase,
                  URLShortenerTestCase, EntryCommentModeratorTestCase,
                  ZinniaCustomDetailViews, SpamCheckerTestCase,
                  EntryAdminTestCase, CategoryAdminTestCase,
                  MixinTestCase, LongEnoughTestCase,
                  AuthorTestCase)

    if 'django_xmlrpc' in settings.INSTALLED_APPS:
        test_cases += (PingBackTestCase, MetaWeblogTestCase)

    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)

    return suite
开发者ID:fuji246,项目名称:django-blog-zinnia,代码行数:28,代码来源:__init__.py

示例8: all_tests

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def all_tests():
    suite = TestSuite()
    loader = TestLoader()

    suite.addTests(loader.loadTestsFromTestCase(RewriterTest))

    return suite
开发者ID:pombredanne,项目名称:hesitate-py,代码行数:9,代码来源:__init__.py

示例9: build_suite

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = TestSuite()
        loader = TestLoader()
        for fname in _get_module_names('.'):
            module = _import(_to_importable_name(fname))
            for test_case in _get_module_testcases(module):
                suite.addTests(loader.loadTestsFromTestCase(test_case))

        return reorder_suite(suite, (TestCase,))
开发者ID:bloodearnest,项目名称:extending_unittest,代码行数:11,代码来源:slide04-alldirs-soln.py

示例10: test_data_cleaned_up

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
 def test_data_cleaned_up(self):
     user_collection.remove()
     company_collection.remove()
     loader = TestLoader()
     suite = loader.loadTestsFromTestCase(TestUnittestSupport.TestTestCase)
     result = TestResult()
     suite.run(result)
     self.assertTrue(result.wasSuccessful(), result)
     self.assertEquals(user_collection.count(), 0)
     self.assertEquals(company_collection.count(), 0)
开发者ID:gamechanger,项目名称:monufacture,代码行数:12,代码来源:unittest_tests.py

示例11: testSuiteFromTCs

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def testSuiteFromTCs(*tcs):
    loader = TestLoader()
    for tc in tcs:
        # skip AxiLiteEndpointTC because we need one to test original methods
        # from SimTestCase
        if issubclass(tc, SimTestCase) and tc is not AxiLiteEndpointTC:
            tc.runSim = runSimWithoutLog
        tc._multiprocess_can_split_ = True
    loadedTcs = [loader.loadTestsFromTestCase(tc) for tc in tcs]
    suite = TestSuite(loadedTcs)
    return suite
开发者ID:Nic30,项目名称:hwtLib,代码行数:13,代码来源:all.py

示例12: suite

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def suite():
    unit_test_cases = ()
    integration_test_cases = (
        URLSmokeTest,
        AuthMiddleWareTest,
        RequestCreateTest, RequestDetailsTest, ProfileDetailsTest, RequestListTest,
        TestAuthentication
    )
    all_test_cases = unit_test_cases + integration_test_cases
    test_loader = TestLoader()
    tests = [test_loader.loadTestsFromTestCase(case) for case in all_test_cases]
    return TestSuite(tests)
开发者ID:e-kolpakov,项目名称:enforta,代码行数:14,代码来源:__init__.py

示例13: combine

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def combine(*args):
    "combine given TestCase classes and suite objects into a new suite"
    loader = TestLoader()
    suites = []
    for arg in args:
        if isinstance(arg, TestSuite):
            suites.append(arg)
        elif issubclass(arg, RealTestCase):
            suites.append(loader.loadTestsFromTestCase(arg))
        else:
            msg = "combine: bad arg type: %s <%s>" % (arg, type(arg))
            raise AssertionError(msg)
    return TestSuite(suites)
开发者ID:tartley,项目名称:sole-scion,代码行数:15,代码来源:testcase.py

示例14: creat

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def creat():
    loadcase=TestLoader()
    testsuite=[]
    suite1=TestSuite()
    suite2=TestSuite()
    caseclass_dict={}
    def backcount(d):
        n=0
        for i in d.values():
            n+=i
        return n
    def caseclass_count(caselist):
        print 'dir caselist',caselist
        for casename in caselist:
            module=loadcase._get_module_from_name(casename)
            for name in dir(module):
                obj = getattr(module,name)
                if isinstance(obj, type) and issubclass(obj, case.TestCase):
                    modeltestcases_list=getTestCaseNames(obj,'test')
                    caseclass_dict[obj]=len(modeltestcases_list)
        return caseclass_dict
    classcase_dict=caseclass_count(backcaselist(dirs+'/bank_case'))
    
    case_and_count_list=back_list(classcase_dict)
    sort_case=SelectSort(case_and_count_list)
    print sort_case
    for i in range(len(sort_case)):
        if i%2==0:
            suite1.addTest(loadcase.loadTestsFromTestCase([x for x in sort_case[i].keys()][0]))
            [x for x in sort_case[i].keys()][0].remoteip='http://172.17.2.136:3344/wd/hub'
        else:
            suite2.addTest(loadcase.loadTestsFromTestCase([x for x in sort_case[i].keys()][0]))
            [x for x in sort_case[i].keys()][0].remoteip='http://172.17.2.57:3344/wd/hub'
    
    print 'suite1',suite1
    print 'suite2',suite2
    testsuite.append(suite1)
    testsuite.append(suite2)
    return testsuite
开发者ID:dhaibo1986,项目名称:PythonWork,代码行数:41,代码来源:all_test.py

示例15: test_all

# 需要导入模块: from unittest import TestLoader [as 别名]
# 或者: from unittest.TestLoader import loadTestsFromTestCase [as 别名]
def test_all():
    loader = TestLoader()
    suites = [
        loader.loadTestsFromTestCase(TestRole),
        loader.loadTestsFromTestCase(TestIP),
        loader.loadTestsFromTestCase(TestHost),
        loader.loadTestsFromTestCase(TestRoleMap),
        loader.loadTestsFromTestCase(TestApi),
        loader.loadTestsFromTestCase(TestHostsOutput),
        loader.loadTestsFromTestCase(TestValidator),
    ]

    testsuites = TestSuite(suites)
    runner = TextTestRunner()
    runner.run(testsuites)
开发者ID:hiroakis,项目名称:host-management-app,代码行数:17,代码来源:runtests.py


注:本文中的unittest.TestLoader.loadTestsFromTestCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。