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


Python TestSuite.addTests方法代码示例

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


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

示例1: loadTestsFromName

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
 def loadTestsFromName(self, name, module=None):
   suite = TestSuite()
   for test in findTests(name):
     sys.path.insert(0, name) # python3 compatibility
     suite.addTests(super(TestLoader, self).loadTestsFromName(test))
     del sys.path[0] # python3 compatibility
   return suite
开发者ID:smielgo99,项目名称:testRepo,代码行数:9,代码来源:test.py

示例2: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def suite():
    import tests.sigv4_test

    ts = TestSuite()
    ts.addTests(tests.sigv4_test.get_test_cases())

    return ts
开发者ID:dacut,项目名称:dist.kanga.org,代码行数:9,代码来源:__init__.py

示例3: load_tests

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def load_tests():
    test_suite = TestSuite()
    this_dir = os.path.dirname(__file__)
    loader = TestLoader()
    package_tests = loader.discover(start_dir=this_dir)
    test_suite.addTests(package_tests)
    return test_suite
开发者ID:ricequant,项目名称:rqalpha,代码行数:9,代码来源:__init__.py

示例4: gen_suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def gen_suite():
    suite = TestSuite()
    suite.addTest(suite_from_file('search_strings.txt', True))
    # suite.addTest(suite_from_file('mobile_useragents.txt', True))
    # suite.addTest(suite_from_file('other_useragents.txt', False))
    suite.addTests(TestLoader().loadTestsFromTestCase(TestHTTPHeaders))
    return suite
开发者ID:tovmeod,项目名称:anaf,代码行数:9,代码来源:tests.py

示例5: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [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

示例6: load_tests

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def load_tests(loader, tests, pattern):

    suite = TestSuite()
    for all_test_suite in defaultTestLoader.discover('.', pattern='*tests.py'):
        for test_suite in all_test_suite:
            suite.addTests(test_suite)
    return suite
开发者ID:mv003348,项目名称:mrgeo,代码行数:9,代码来源:mrgeotest.py

示例7: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def suite():
    suite = TestSuite()
    suite.addTests(
        defaultTestLoader.loadTestsFromTestCase(TestSubmissionModule))
    suite.addTests(
        defaultTestLoader.loadTestsFromTestCase(TestSubmission))
    return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:9,代码来源:test_submission.py

示例8: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [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

示例9: load_tests

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def load_tests (loader, tests, pattern):
    from unittest import TestSuite
    from . import future, pair, source, async, limit, file, buffered, event

    suite = TestSuite ()
    for test in (future, pair, source, async, limit, file, buffered, event):
        suite.addTests (loader.loadTestsFromModule (test))
开发者ID:aslpavel,项目名称:async,代码行数:9,代码来源:__init__.py

示例10: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def suite():
    suite = TestSuite()
    for m in UNIT_TESTS:
        suite.addTests(TestLoader().loadTestsFromName(m))
    for m in DOC_TESTS:
        suite.addTest(DocTestSuite(__import__(m, {}, {}, [''])))
    return suite
开发者ID:cloudappsetup,项目名称:scrapely,代码行数:9,代码来源:__init__.py

示例11: all_tests

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

    suite.addTests(loader.loadTestsFromTestCase(RewriterTest))

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

示例12: test_suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def test_suite():
    from unittest import TestSuite, makeSuite
    tests = []
    tests.append(makeSuite(DeviceIdTest))
    suite = TestSuite()
    suite.addTests(tests)
    return suite
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:9,代码来源:testDeviceIdentification.py

示例13: TestHTMLTestRunner

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
class TestHTMLTestRunner(TestCase):
    
    def setUp(self):
   
        self.suite = TestSuite()
        self.loader = TestLoader()

        self.suite.addTests(self.loader.loadTestsFromModule(tests.SampleTestPass))
        self.suite.addTests(self.loader.loadTestsFromModule(tests.SampleTestFail))
        self.suite.addTests(self.loader.loadTestsFromModule(tests.SampleTestBasic))

        self.results_output_buffer = StringIO()
        HTMLTestRunner(stream=self.results_output_buffer).run(self.suite)
        self.byte_output = self.results_output_buffer.getvalue()

    def test_SampleTestPass(self):
        output1="".join(self.byte_output.split())
        output2="".join(SampleTestPass.EXPECTED_RESULT.split())
        self.assertGreater(output1.find(output2),0)
    
    @skip("Test Skipping")
    def test_SampleTestSkip(self):
        self.fail("This error should never be displayed")
        
    def test_SampleTestFail(self):
        output1="".join(self.byte_output.split())
        output2="".join(SampleTestFail.EXPECTED_RESULT.split())
        self.assertGreater(output1.find(output2),0)
        
    def test_SampleTestBasic(self):
        output1="".join(self.byte_output.split())
        output2="".join(SampleTestBasic.EXPECTED_RESULT.split())
        self.assertGreater(output1.find(output2),0)
开发者ID:dash0002,项目名称:HTMLTestRunner,代码行数:35,代码来源:test_HTMLTestRunner.py

示例14: suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def suite():
    ts = TestSuite()
    tests = [BenchMarkTest, BenchmarkModuleTest]

    ts.addTests(map(makeSuite, tests))

    return ts
开发者ID:hagaeru3sei,项目名称:pybench,代码行数:9,代码来源:BenchmarkTest.py

示例15: make_test_suite

# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTests [as 别名]
def make_test_suite():
    """Load unittests placed in pybrain/tests/unittests, then return a
    TestSuite object of those."""
    # [...]/pybrain/pybrain [cut] /tests/runtests.py
    path = os.path.abspath(__file__).rsplit(os.sep+'tests', 1)[0]

    sys.path.append(path.rstrip('pybrain'))

    top_testdir = os.path.join(path, 'tests', 'unittests')
    testdirs = getSubDirectories(top_testdir)
    
    # Initialize the testsuite to add to
    suite = TestSuite()
    optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.IGNORE_EXCEPTION_DETAIL
    
    for testdir in testdirs:
        # All unittest modules have to start with 'test_' and have to be, of
        # course, python files
        module_names = [f[:-3] for f in os.listdir(testdir)
                        if f.startswith('test_') and f.endswith('.py')]
        
        if not module_names:
            logging.info('No tests found in %s' % testdir)
            continue
        
        # "Magically" import the tests package and its test-modules that we've
        # found
        test_package_path = 'pybrain.tests.unittests'
        sub_path = os.path.relpath(testdir, top_testdir).split(os.sep)
        test_package_path = '.'.join([test_package_path]+sub_path)
        test_package = __import__(test_package_path, fromlist=module_names)
    
        # Put the test modules in a list that can be passed to the testsuite
        modules = (getattr(test_package, n) for n in module_names)
        modules = [(m, missingDependencies(m)) for m in modules]
        untests = [(m, md) for m, md in modules if md]
        modules = [m for m, md in modules if not md]
    
        # print(out modules that are missing dependencies)
        for module, miss_dep in untests:    # Mr Dep is not around, though
            logging.warning('Module %s is missing dependencies: %s' % (
                            module.__name__, ', '.join(miss_dep)))
    
        # print(out a list of tests that are found)
        for m in modules:
            logging.info('Tests found: %s' % m.__name__)
    
        # Build up the testsuite
        suite.addTests([TestLoader().loadTestsFromModule(m) for m in modules])

        # Add doctests from the unittest modules to the suite
        for mod in modules:
            try:
                suite.addTest(doctest.DocTestSuite(mod, optionflags=optionflags))
            except ValueError:
                # No tests found.
                pass

    return suite
开发者ID:Angeliqe,项目名称:pybrain,代码行数:61,代码来源:runtests.py


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