コード例 #1
0
ファイル: __init__.py プロジェクト: aslpavel/async
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))
コード例 #2
0
ファイル: __init__.py プロジェクト: zeta1999/breezy
def test_suite():
    result = TestSuite()
    from . import testemail

    loader = TestLoader()
    result.addTests(loader.loadTestsFromModule(testemail))
    return result
コード例 #3
0
ファイル: __init__.py プロジェクト: ricequant/rqalpha
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
コード例 #4
0
ファイル: tests.py プロジェクト: tovmeod/anaf
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
コード例 #5
0
def load_doctests(
        loader: Any, tests: TestSuite, ignore: Any, module: ModuleType,
        additional_skip_names: Optional[
            List[Union[str, ModuleType]]] = None,
        modules_to_reload: Optional[List[ModuleType]] = None,
        modules_to_patch: Optional[Dict[str, ModuleType]] = None,
        allow_root_user: bool = True,
        use_known_patches: bool = True,
        patch_open_code: PatchMode = PatchMode.OFF,
        patch_default_args: bool = False
) -> TestSuite:  # pylint:disable=unused-argument
    """Load the doctest tests for the specified module into unittest.
        Args:
            loader, tests, ignore : arguments passed in from `load_tests()`
            module: module under test
            remaining args: see :py:class:`TestCase` for an explanation

    File `example_test.py` in the pyfakefs release provides a usage example.
    """
    _patcher = Patcher(additional_skip_names=additional_skip_names,
                       modules_to_reload=modules_to_reload,
                       modules_to_patch=modules_to_patch,
                       allow_root_user=allow_root_user,
                       use_known_patches=use_known_patches,
                       patch_open_code=patch_open_code,
                       patch_default_args=patch_default_args)
    globs = _patcher.replace_globs(vars(module))
    tests.addTests(doctest.DocTestSuite(module,
                                        globs=globs,
                                        setUp=_patcher.setUp,
                                        tearDown=_patcher.tearDown))
    return tests
コード例 #6
0
def suite():
    from unittest import TestSuite, defaultTestLoader

    suite = TestSuite()
    suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestRDFHelp))
    suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestRDFSchemas))
    return suite
コード例 #7
0
ファイル: __init__.py プロジェクト: aslpavel/async
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))
コード例 #8
0
def load_tests(loader, tests, pattern):
    ''' Ensure TestHTMLBlocks doesn't get run twice by excluding it here. '''
    suite = TestSuite()
    for test_class in [TestDefaultwMdInHTML, TestMdInHTML, TestMarkdownInHTMLPostProcessor]:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
コード例 #9
0
def test_suite():
    suite = TestSuite()

    basicsearchtest = layered(
        doctest.DocFileSuite(
            "tests/basicsearch.txt",
            package="collective.searchandreplace",
            optionflags=oflags,
        ),
        layer=SEARCH_REPLACE_FUNCTIONAL_LAYER,
    )

    searchavailabletest = layered(
        doctest.DocFileSuite(
            "tests/searchavailable.txt",
            package="collective.searchandreplace",
            optionflags=oflags,
        ),
        layer=SEARCH_REPLACE_FUNCTIONAL_LAYER,
    )

    suite.addTests([
        basicsearchtest,
        searchavailabletest,
    ])

    return suite
コード例 #10
0
ファイル: mrgeotest.py プロジェクト: mv003348/mrgeo
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
コード例 #11
0
def suite():
    users = [user_staff, user_staff, user_none
             ] + users_sponsors + users_secretariat
    settings.ENABLE_CAPTCHA = False
    settings.TEMPLATE_STRING_IF_INVALID = "BAD TEMPLATE"

    suite = TestSuite()
    suite.addTests(
        LoginTestCase.parametrize(AccountManagementTest,
                                  [user_staff, user_staff, user_none]))
    suite.addTests(
        LoginTestCase.parametrize(CreateConferenceTest,
                                  [user_staff, user_none]))
    suite.addTests(
        LoginTestCase.parametrize(AccountManagementTest,
                                  [sponsor1, sponsor2, sponsor3, sponsor4]))
    #suite.addTests(LoginTestCase.parametrize(CreateSchoolTest, users))
    suite.addTests(
        LoginTestCase.parametrize(AccountManagementTest,
                                  users_secretariat + users_sponsors))
    #suite.addTests(LoginTestCase.parametrize(ConferenceTest, users))
    suite.addTests(LoginTestCase.parametrize(ConfigureRegistrationTest, users))
    #suite.addTests(LoginTestCase.parametrize(SchoolRegistrationTest, users))
    #suite.addTests(LoginTestCase.parametrize(CountryAssignmentTest, users))
    #suite.addTests(LoginTestCase.parametrize(DelegateRegistrationTest, users))
    #suite.addTests(LoginTestCase.parametrize(PaymentsTest, users))
    #suite.addTests(LoginTestCase.parametrize(ConferenceTest, users))
    return suite
コード例 #12
0
ファイル: __init__.py プロジェクト: dacut/dist.kanga.org
def suite():
    import tests.sigv4_test

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

    return ts
コード例 #13
0
ファイル: test.py プロジェクト: xixilog/python-printer-escpos
 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
コード例 #14
0
ファイル: BenchmarkTest.py プロジェクト: hagaeru3sei/pybench
def suite():
    ts = TestSuite()
    tests = [BenchMarkTest, BenchmarkModuleTest]

    ts.addTests(map(makeSuite, tests))

    return ts
コード例 #15
0
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
コード例 #16
0
def suite():
    suite = TestSuite()
    suite.addTests(
        defaultTestLoader.loadTestsFromTestCase(TestSubmissionModule))
    suite.addTests(
        defaultTestLoader.loadTestsFromTestCase(TestSubmission))
    return suite
コード例 #17
0
def all_tests():
    suite = TestSuite()
    loader = TestLoader()

    suite.addTests(loader.loadTestsFromTestCase(RewriterTest))

    return suite
コード例 #18
0
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
コード例 #19
0
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
コード例 #20
0
def main():
    os.environ["PYTHON_API_KEY"] = api_key

    test_suites = _collect_test_suites()
    main_test_suite = TestSuite()

    for test_suite in test_suites:
        main_test_suite.addTests(test_suite)

    concurrent_suite = ConcurrentStreamTestSuite(
        lambda: ((case, None) for case in main_test_suite))

    result = StreamToDict(callback)
    result.startTestRun()
    try:
        concurrent_suite.run(result)
    finally:
        result.stopTestRun()

    all = SUCCESS + FAILS
    print("All: " + str(all) + " SUCCESS: " + str(SUCCESS) + " FAILS: " +
          str(FAILS))

    if 'FAILED' in globals() and FAILED:
        sys.exit(1)
コード例 #21
0
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
コード例 #22
0
ファイル: tests.py プロジェクト: GPortas/Playgroundb
    def handle(self, *args, **options):
        suite = TestSuite()
        env = options['environment'][0]
        if options['test_case'] is not None:
            test_case = options['test_case']
        else:
            test_case = None
        if env == 'unit':
            pattern = '*UnitTest.py'
        elif env == 'integration':
            pattern = '*IntegrationTest.py'
        elif env == 'functional':
            pattern = '*FunctionalTest.py'
        else:
            raise ValueError('Invalid environment')
        if test_case is not None:
            pattern = test_case + ".py"
        for all_test_suite in unittest.defaultTestLoader.discover(
                'tests', pattern=pattern):
            for test_suite in all_test_suite:
                try:
                    suite.addTests(test_suite)
                except Exception as e:
                    print("Error while adding test suite (" + str(test_suite) +
                          "): " + str(e))
                    raise e

        runner = TextTestRunner(verbosity=1)
        result = runner.run(suite)
        sys.exit(not result.wasSuccessful())
コード例 #23
0
ファイル: __init__.py プロジェクト: cloudappsetup/scrapely
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
コード例 #24
0
ファイル: test.py プロジェクト: smielgo99/testRepo
 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
コード例 #25
0
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    for test_class in (RunMainPage, NewUserReg, UserLogIn, Logout, ResetPassword, UpdateUserInfo, BrandPage,
                       TakeActionVisitor, TakeActionUser):
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
コード例 #26
0
def test_suite():
    from unittest import TestSuite, makeSuite
    tests = []
    tests.append(makeSuite(DeviceIdTest))
    suite = TestSuite()
    suite.addTests(tests)
    return suite
コード例 #27
0
ファイル: __init__.py プロジェクト: zeta1999/breezy
def test_suite():
    result = TestSuite()
    from . import test_news_merge

    loader = TestLoader()
    result.addTests(loader.loadTestsFromModule(test_news_merge))
    return result
コード例 #28
0
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)
コード例 #29
0
def load_tests(  # pylint: disable=unused-argument
        loader: TestLoader,
        tests: TestSuite,
        ignore: typing.Optional[str] = None) -> TestSuite:
    """Load doctests"""
    tests.addTests(doctest.DocTestSuite("django_ca.subject"))
    return tests
コード例 #30
0
ファイル: mrgeotest.py プロジェクト: feihugis/mrgeo
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
コード例 #31
0
def suite():
    suite = TestSuite()
    loader = TestLoader()
    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
コード例 #32
0
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)

    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
コード例 #33
0
ファイル: runtests.py プロジェクト: Angeliqe/pybrain
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
コード例 #34
0
def load_tests(loader, tests, pattern):
    logger = logging.getLogger()
    logger.setLevel(logging.ERROR)
    suite = TestSuite()
    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
コード例 #35
0
ファイル: __init__.py プロジェクト: aslpavel/pretzel-old
def load_tests(loader, tests, pattern):
    from unittest import TestSuite
    from . import tests

    suite = TestSuite()
    for test in (tests,):
        suite.addTests(loader.loadTestsFromModule(test))
    return suite
コード例 #36
0
ファイル: integration_util.py プロジェクト: tiger-tiger/ample
 def run_unittest_suite(self):
     suite = TestSuite()
     for name in self.test_dict.keys():
         testClass = self.test_dict[name]['test']
         testClass.RESULTS_PKL = self.test_dict[name]['resultsd']
         _suite = TestLoader().loadTestsFromTestCase(testClass)
         suite.addTests(_suite)
     TextTestRunner(verbosity=2).run(suite)
コード例 #37
0
ファイル: tests.py プロジェクト: collective/p4a.ploneevent
def test_suite():
    from unittest import TestSuite, makeSuite

    suite = TestSuite()
    suite.addTests(makeSuite(RecurrenceTest))
    suite.layer = layer.ZCMLLayer

    return suite
コード例 #38
0
def suite():
    """ returns all the testcases in this module """
    suite = TestSuite()
    suite.addTests(TestLoaderFiltered().loadTestsFromTestCase(
        TclModuleGeneratorTest, sys.argv[1:]))
    suite.addTests(TestLoaderFiltered().loadTestsFromTestCase(
        LuaModuleGeneratorTest, sys.argv[1:]))
    return suite
コード例 #39
0
def test_suite():

    suite = TestSuite()
    suite.addTests(makeSuite(ATEventProviderTest))
    suite.addTests(makeSuite(TopicEventProviderTest))
    suite.layer = layer.ZCMLLayer

    return suite
コード例 #40
0
ファイル: __init__.py プロジェクト: ojengwa/phonio
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    names = ('phonio.test.softphone_test',
            'phonio.test.dialer_test' )
    for name in names:
        tests = loader.loadTestsFromName(name)
        suite.addTests(tests)
    return suite
コード例 #41
0
def test_suites():
    test_loader = TestLoader()
    test_suite = TestSuite()
    # test_suite.addTest(UserGUI('test_U0001'))
    test_suite.addTests([
        test_loader.loadTestsFromTestCase(UserGUI),
    ])
    return test_suite
コード例 #42
0
def load_tests(*_):
    """Load doctests as unittest test suite.

    For the parameters, see :mod:`unittest`. The parameters are unused here.
    """
    suite = TestSuite()
    suite.addTests(DocTestSuite('COT.ui.cli'))
    return suite
コード例 #43
0
def suite():
    from unittest import TestSuite, defaultTestLoader
    suite = TestSuite()
    for testcase in [ExerimentsTestCases,
                     TestEmailNotify,
                     TestSequencer]:
        suite.addTests(defaultTestLoader.loadTestsFromTestCase(testcase))
    return suite
コード例 #44
0
ファイル: __init__.py プロジェクト: jokey2k/pyClanSphere
def suite(app, modnames=[], return_covermods=False):
    """Generate the test suite.

    First argument is always the instance to use. Use a real one or a temporary.
    The second argument is a list of modules to be tested. If it is empty (which
    it is by default), all sub-modules of the pyClanSphere package are tested.
    If the second argument is True, this function returns two objects: a
    TestSuite instance and a list of the names of the tested modules. Otherwise
    (which is the default) it only returns the former. This is done so that
    this function can be used as setuptools' test_suite.
    """

    # the app object is used for two purposes:
    # 1) plugins are not usable (i.e. not testable) without an initialised app
    # 2) for functions that require an application object as argument, you can
    #    write >>> my_function(app, ...) in the tests
    # The instance directory of this object is located in the tests directory.
    #
    # setup isn't imported at module level because this way coverage
    # can track the whole pyClanSphere imports

    if return_covermods:
        covermods = []
    suite = TestSuite()

    if modnames == []:
        modnames = find_tp_modules()
    test_files = os.listdir(dirname(__file__))
    for modname in modnames:

        # the fromlist must contain something, otherwise the pyClanSphere
        # package is returned, not our module
        try:
            mod = __import__(modname, None, None, [''])
        except ImportError, exc:
            # some plugins can have external dependencies (e.g. creoleparser,
            # pygments) that are not installed on the machine the tests are
            # run on. Therefore, just skip those (with an error message)
            if 'plugins.' in modname:
                if 'versions.' not in modname and 'tests.' not in modname:
                    sys.stderr.write('could not import plugin %s: %s\n' % (modname, exc))
                continue
            else:
                raise
        suites = [DocTestSuite(mod, extraglobs={'app': app})]
        filename = modname[10:] + '.txt'
        if filename in test_files:
            globs = {'app': app}
            globs.update(mod.__dict__)
            suites.append(DocFileSuite(filename, globs=globs))
        for i, subsuite in enumerate(suites):
            # skip modules without any tests
            if subsuite.countTestCases():
                suite.addTest(subsuite)
                if return_covermods and i == 0:
                    covermods.append(mod)
        if 'tests.' in modname:
            suite.addTests(defaultTestLoader.discover(modname))
コード例 #45
0
def suite():
    """Suite of TestCases for Django"""
    suite = TestSuite()
    loader = TestLoader()

    test_cases = (
        # Models
        EntryTestCase,
        AuthorTestCase,
        CategoryTestCase,
        ManagersTestCase,
        LoadModelClassTestCase,
        # Admin
        EntryAdminTestCase,
        CategoryAdminTestCase,
        EntryAdminFormTestCase,
        CategoryAdminFormTestCase,
        AuthorListFilterTestCase,
        CategoryListFilterTestCase,
        MPTTModelChoiceIteratorTestCase,
        MPTTModelMultipleChoiceFieldTestCase,
        MPTTFilteredSelectMultipleTestCase,
        # Front
        MixinTestCase,
        ViewsTestCase,
        CustomDetailViewsTestCase,
        FeedsTestCase,
        SitemapsTestCase,
        ComparisonTestCase,
        TemplateTagsTestCase,
        # HTML
        HTMLPreviewTestCase,
        EntryHtmlContentTestCase,
        MarkupsTestCase,
        MarkupFailImportTestCase,
        # URLs
        URLShortenerTestCase,
        TranslatedURLsTestCase,
        EntryAbsoluteUrlTestCase,
        # Discussions
        FlagsTestCase,
        SignalsTestCase,
        LongEnoughTestCase,
        SpamCheckerTestCase,
        CommentModeratorTestCase,
        # Pinging
        DirectoryPingerTestCase,
        ExternalUrlsPingerTestCase,
        # XML-RPC
        PingBackTestCase,
        MetaWeblogTestCase,
    )

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

    return suite
コード例 #46
0
ファイル: test_doctests.py プロジェクト: glennmatthews/cot
def load_tests(*_):
    """Load doctests as unittest test suite.

    For the parameters, see :mod:`unittest`. The parameters are unused here.
    """
    suite = TestSuite()
    suite.addTests(DocTestSuite('COT.data_validation'))
    suite.addTests(DocTestSuite('COT.utilities'))
    return suite
コード例 #47
0
ファイル: __init__.py プロジェクト: Tavpritesh/cobrapy
def create_test_suite():
    """create a unittest.TestSuite with available tests"""
    from unittest import TestLoader, TestSuite
    loader = TestLoader()
    suite = TestSuite()
    for test_name in available_tests:
        exec("from . import " + test_name)
        suite.addTests(loader.loadTestsFromModule(eval(test_name)))
    return suite
コード例 #48
0
ファイル: tests.py プロジェクト: rockfruit/mars
def test_suite():
    from unittest import TestSuite, makeSuite
    suite = TestSuite()
    suite.addTests((DocFileSuite(
        'storage.txt',
        tearDown=tearDown,
        optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
    ), ))
    return suite
コード例 #49
0
def load_tests(loader, tests, pattern):
    from unittest import TestSuite, TestLoader
    if not ZODB:
        from unittest import SkipTest
        raise SkipTest("ZODB not installed")
    suite = TestSuite()
    suite.addTests(TestLoader().loadTestsFromTestCase(ZODBGraphTestCase))
    suite.addTests(TestLoader().loadTestsFromTestCase(ZODBContextTestCase))
    return suite
コード例 #50
0
ファイル: __init__.py プロジェクト: aslpavel/pretzel-old
def load_tests (loader, tests, pattern):
    from unittest import TestSuite
    from . import hub, result, expr, proxy, conn

    suite = TestSuite ()
    for test in (hub, result, expr, proxy, conn,):
        suite.addTests (loader.loadTestsFromModule (test))

    return suite
コード例 #51
0
 def run_unittest_suite(self):
     suite = TestSuite()
     for name in self.test_dict.keys():
         testClass = self.test_dict[name]['test']
         testClass.WORK_DIR = self.test_dict[name]['work_dir']
         testClass.RESULTS_PKL = os.path.join(testClass.WORK_DIR, AMPLE_PKL)
         _suite = TestLoader().loadTestsFromTestCase(testClass)
         suite.addTests(_suite)  
     TextTestRunner(verbosity=2).run(suite)
コード例 #52
0
    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,))
コード例 #53
0
ファイル: test_rdflib.py プロジェクト: lucag/sparrow
def test_suite():
    try:
        sparrow.database('rdflib', 'memory')
    except ConnectionError:
        print('rdflib not installed?')
        return TestSuite()
    suite = TestSuite()
    suite.addTests(make_suite(RDFLibTest, RDFLibQueryTest))
    return suite
コード例 #54
0
ファイル: test_zodb.py プロジェクト: RDFLib/rdflib-zodb
def load_tests(loader, tests, pattern):
    from unittest import TestSuite, TestLoader
    if not ZODB:
        from unittest import SkipTest
        raise SkipTest("ZODB not installed")
    suite = TestSuite()
    suite.addTests(TestLoader().loadTestsFromTestCase(ZODBGraphTestCase))
    suite.addTests(TestLoader().loadTestsFromTestCase(ZODBContextTestCase))
    return suite
コード例 #55
0
ファイル: __init__.py プロジェクト: fchauvel/flap
def load_tests(loader, tests, pattern):
    file_system = OSFileSystem()
    repository = FileBasedTestRepository(file_system, Path.fromText("tests/acceptance/scenarios"), YamlCodec())
    runner = EndToEndRunner(file_system)
    generate = Generator(repository, runner)
    suite = TestSuite()
    tests = loader.loadTestsFromTestCase(generate.test_class())
    suite.addTests(tests)
    return suite
コード例 #56
0
def load_tests(loader, tests, pattern):
    lines = "-" * 100
    suite = TestSuite()
    testCases = test_cases
    print testCases
    for test_class in testCases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite