コード例 #1
0
def test_suite():
    suite = DocTestSuite(
            "lp.services.database.postgresql",
            setUp=setUp, tearDown=tearDown
            )
    suite.layer = BaseLayer
    return suite
コード例 #2
0
def suitefor(module):
    """Make a doctest suite with common setUp and tearDown functions."""
    suite = DocTestSuite(
        module, setUp=setUp, tearDown=tearDown,
        optionflags=ELLIPSIS | NORMALIZE_WHITESPACE)
    # We have to invoke the LaunchpadFunctionalLayer in order to
    # initialize the ZCA machinery, which is a pre-requisite for using
    # login().
    suite.layer = LaunchpadFunctionalLayer
    return suite
コード例 #3
0
def test_suite():
    suite = TestSuite()
    import lp.app.validators.validation
    test = DocTestSuite(
        lp.app.validators.validation,
        setUp=setUp,
        tearDown=tearDown,
        optionflags=ELLIPSIS | NORMALIZE_WHITESPACE
        )
    # We have to invoke the LaunchpadFunctionalLayer in order to
    # initialize the ZCA machinery, which is a pre-requisite for using
    # login().
    test.layer = LaunchpadFunctionalLayer
    suite.addTest(test)
    return suite
コード例 #4
0
def test_suite():
    """Return a suite of canonical.conf and all conf files."""
    suite = unittest.TestSuite()
    suite.addTest(DocTestSuite(
        'lp.services.config',
        optionflags=NORMALIZE_WHITESPACE | ELLIPSIS,
        ))
    load_testcase = unittest.defaultTestLoader.loadTestsFromTestCase
    # Add a test for every launchpad[.lazr].conf file in our tree.
    for config_dir in lp.services.config.CONFIG_ROOT_DIRS:
        for dirpath, dirnames, filenames in scandir.walk(config_dir):
            if os.path.basename(dirpath) in EXCLUDED_CONFIGS:
                del dirnames[:]  # Don't look in subdirectories.
                continue
            for filename in filenames:
                if filename == 'launchpad.conf':
                    config_file = os.path.join(dirpath, filename)
                    description = os.path.relpath(config_file, config_dir)
                    suite.addTest(make_test(config_file, description))
                elif filename.endswith('-lazr.conf'):
                    # Test the lazr.config conf files.
                    config_file = os.path.join(dirpath, filename)
                    description = os.path.relpath(config_file, config_dir)
                    testcase = make_config_test(config_file, description)
                    suite.addTest(load_testcase(testcase))
                else:
                    # This file is not a config that can be validated.
                    pass
    # Other tests.
    suite.addTest(load_testcase(TestLaunchpadConfig))
    return suite
コード例 #5
0
def test_suite():
    checker = renormalizing.RENormalizing([
        (re.compile(r"object of type 'MyIter' has no len\(\)"),
         r"len() of unsized object"),
    ])
    suite = unittest.makeSuite(TALESTests)
    suite.addTest(DocTestSuite("zope.tales.tales", checker=checker))
    return suite
コード例 #6
0
def test_suite():
    checker = renormalizing.RENormalizing([
        (re.compile(r"object of type 'MyIter' has no len\(\)"),
         r"len() of unsized object"),
    ])
    suite = unittest.defaultTestLoader.loadTestsFromName(__name__)
    suite.addTest(DocTestSuite("zope.tales.tales", checker=checker))
    return suite
コード例 #7
0
def test_suite():
    return TestSuite((
        makeSuite(TestBTreeContainer),
        makeSuite(TestBTreeSpecials),
        DocTestSuite('zope.container.btree',
                     setUp=setUp,
                     tearDown=tearDown),
        ))
コード例 #8
0
def test_suite():
    suite = unittest.TestSuite()
    suite.addTests([
        layered(DocTestSuite(module='bika.lims.vocabularies',
                             optionflags=OPTIONFLAGS),
                layer=BIKA_FUNCTIONAL_TESTING),
    ])
    return suite
コード例 #9
0
def suite():
    try:
        from doctest import DocTestSuite
        return DocTestSuite(clearsilver)
    except ImportError:
        import sys
        print >> sys.stderr, "WARNING: DocTestSuite required to run these tests"
    return unittest.TestSuite()
コード例 #10
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
コード例 #11
0
ファイル: test_pod.py プロジェクト: kissiel/checkbox-ng
def load_tests(loader, tests, ignore):
    """
    Protocol for loading unit tests.

    This function ensures that doctests are executed as well.
    """
    tests.addTests(DocTestSuite('plainbox.impl.pod'))
    return tests
コード例 #12
0
ファイル: test_doctests.py プロジェクト: doun/Bika-LIMS
def test_suite():
    suite = unittest.TestSuite()
    for module in DOCTESTS:
        suite.addTests([
            layered(DocTestSuite(module=module, optionflags=OPTIONFLAGS),
                    layer=BIKA_FUNCTIONAL_TESTING),
        ])
    return suite
コード例 #13
0
ファイル: test_directives.py プロジェクト: c0ns0le/zenoss-4
def test_suite():
    if not HAVE_ZCML:
        return unittest.TestSuite()

    return unittest.TestSuite((
        unittest.makeSuite(TestFactoryDirective),
        unittest.makeSuite(TestRequireDirective),
        DocTestSuite(),
    ))
コード例 #14
0
def test_suite():

    checker = RENormalizing([
        # Python 3 includes module name in exceptions
        (re.compile(r"zope.publisher.interfaces.NotFound"), "NotFound"),
    ])

    return unittest.TestSuite((DocTestSuite('zope.publisher.browser',
                                            checker=checker), ))
コード例 #15
0
def load_tests(loader, tests, ignore):
    """Run our main documentation as a test."""

    # Python 2.6 formats floating-point numbers a bit differently and
    # breaks the doctest.
    if sys.version_info >= (2, 7):
        tests.addTests(DocTestSuite('sgp4', optionflags=ELLIPSIS))

    return tests
コード例 #16
0
def test_suite():
    checker = renormalizing.RENormalizing(((re.compile(r"u('.*')"), r'\1'), ))

    return unittest.TestSuite((
        DocTestSuite('zope.app.onlinehelp',
                     setUp=setUp,
                     tearDown=testing.tearDown,
                     checker=checker),
        DocTestSuite('zope.app.onlinehelp.onlinehelptopic',
                     setUp=setUp,
                     tearDown=testing.tearDown,
                     checker=checker),
        DocTestSuite('zope.app.onlinehelp.onlinehelp',
                     setUp=setUp,
                     tearDown=testing.tearDown,
                     checker=checker),
        unittest.defaultTestLoader.loadTestsFromName(__name__),
    ))
コード例 #17
0
def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Python_ZSPTests))
    suite.addTest(unittest.makeSuite(C_ZSPTests))
    suite.addTest(unittest.makeSuite(Python_SMTests))
    suite.addTest(unittest.makeSuite(C_SMTests))
    suite.addTest(DocTestSuite())
    suite.addTest(unittest.makeSuite(GetRolesWithMultiThreadTest))
    return suite
コード例 #18
0
def test_main():
    suite = unittest.TestSuite()
    suite.addTest(DocTestSuite('_threading_local'))
    suite.addTest(unittest.makeSuite(ThreadLocalTest))
    suite.addTest(unittest.makeSuite(PyThreadingLocalTest))

    local_orig = _threading_local.local

    def setUp(test):
        _threading_local.local = _thread._local

    def tearDown(test):
        _threading_local.local = local_orig

    suite.addTest(
        DocTestSuite('_threading_local', setUp=setUp, tearDown=tearDown))

    support.run_unittest(suite)
コード例 #19
0
ファイル: test_formlib.py プロジェクト: aodag/five.formlib
def test_suite():
    return unittest.TestSuite([
        DocTestSuite(),
        FunctionalDocFileSuite(
            'forms.txt',
            package="five.formlib.tests",
        ),
        FunctionalDocFileSuite('formlib.txt', package='five.formlib.tests'),
    ])
コード例 #20
0
def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(
        DocTestSuite(
            'lp.services.webapp.notifications',
            setUp=setUp,
            tearDown=tearDown,
        ))
    return suite
コード例 #21
0
ファイル: __init__.py プロジェクト: Aareon/arcade
def load_tests(loader=None, tests=None, pattern=None):
    suite = TestSuite()
    suite.addTests(DocTestSuite('arcade.draw_commands'))
    suite.addTests(DocTestSuite('arcade.buffered_draw_commands'))
    suite.addTests(DocTestSuite('arcade.window_commands'))
    suite.addTests(DocTestSuite('arcade.geometry'))
    suite.addTests(DocTestSuite('arcade.sprite'))
    suite.addTests(DocTestSuite('arcade.application'))
    suite.addTests(DocTestSuite('arcade.sound'))
    suite.addTests(DocTestSuite('arcade.physics_engines'))
    return suite
コード例 #22
0
def test_main():
    suite = DocTestSuite('_threading_local')

    try:
        from thread import _local
    except ImportError:
        pass
    else:
        import _threading_local
        local_orig = _threading_local.local
        def setUp(test):
            _threading_local.local = _local
        def tearDown(test):
            _threading_local.local = local_orig
        suite.addTest(DocTestSuite('_threading_local',
                                   setUp=setUp, tearDown=tearDown)
                      )

    test_support.run_suite(suite)
コード例 #23
0
def test_suite():
    suite = unittest.TestLoader().loadTestsFromName(__name__)
    suite.addTest(DocTestSuite('lp.services.mail.incoming'))
    suite.addTest(
        LayeredDocFileSuite('incomingmail.txt',
                            setUp=setUp,
                            tearDown=tearDown,
                            layer=LaunchpadZopelessLayer,
                            stdout_logging_level=logging.WARNING))
    return suite
コード例 #24
0
ファイル: doctest.py プロジェクト: joelostblom/ndindex
def load_tests(loader, tests, ignore):
    for mod in sys.modules:
        if mod.startswith('ndindex'):
            # globs={} makes the doctests not include module names
            tests.addTests(DocTestSuite(sys.modules[mod], globs={},
                                        optionflags=NORMALIZE_WHITESPACE))
    tests.addTests(DocFileSuite(*MARKDOWN, *RST, README,
                                optionflags=NORMALIZE_WHITESPACE,
                                module_relative=False))
    return tests
コード例 #25
0
def test_suite():
    return unittest.TestSuite([
        DocTestSuite(),
        FunctionalDocFileSuite(
            'forms.txt',
            package="five.formlib.tests",
            globs=dict(http_request=http_request),
        ),
        FunctionalDocFileSuite('formlib.txt', package='five.formlib.tests'),
    ])
コード例 #26
0
 def run(self):
     tests = TestLoader().loadTestsFromName('hetzner.tests')
     for module in PYTHON_MODULES:
         try:
             doctests = DocTestSuite(module)
         except ValueError:
             continue
         tests.addTests(doctests)
     result = TextTestRunner(verbosity=1).run(tests)
     sys.exit(not result.wasSuccessful())
コード例 #27
0
def test_suite():
    checker = RENormalizing([
        # Python 3 includes module name in exceptions
        (re.compile(r"zope.location.interfaces.LocationError"), "LocationError"
         ),
    ])

    return DocTestSuite('zope.traversing.namespace',
                        setUp=setUp,
                        tearDown=tearDown,
                        checker=checker)
コード例 #28
0
ファイル: cron.py プロジェクト: MarsStirner/bouser.hitsl
def test_suite():
    suite = TestSuite()
    suite.addTest(TestLoader().loadTestsFromTestCase(SimpleTests))
    suite.addTest(TestLoader().loadTestsFromTestCase(AllDOMTestCase))
    suite.addTest(TestLoader().loadTestsFromTestCase(AllDOWTestCase))
    suite.addTest(TestLoader().loadTestsFromTestCase(FillingCoverageTestCase))
    suite.addTest(TestLoader().loadTestsFromTestCase(RangeTestCase))
    suite.addTest(TestLoader().loadTestsFromTestCase(StarTestCase))

    suite.addTest(DocTestSuite(cron))
    return suite
コード例 #29
0
def test_suite():
    suite = unittest.TestSuite([
        unittest.defaultTestLoader.loadTestsFromName(__name__),
    ])
    suite.addTest(
        DocTestSuite("zope.container.ordered",
                     setUp=testing.setUp,
                     tearDown=testing.tearDown,
                     checker=testing.checker))

    return suite
コード例 #30
0
def test_main():
    suite = DocTestSuite('_threading_local')

    try:
        from eventlet.green.thread import _local
    except ImportError:
        pass
    else:
        import _threading_local
        local_orig = _threading_local.local
        def setUp(test):
            _threading_local.local = _local
        def tearDown(test):
            _threading_local.local = local_orig
        suite.addTest(DocTestSuite('_threading_local',
                                   setUp=setUp, tearDown=tearDown)
                      )
        suite.addTest(unittest.makeSuite(ThreadingLocalTest))

    test_support.run_suite(suite)
コード例 #31
0
def make_full_suite():
    from doctest import DocTestFinder, DocTestSuite
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()
    finder = DocTestFinder()
    for modname in (__name__, "pylibmc", "_pylibmc"):
        ss = (DocTestSuite(sys.modules[modname], test_finder=finder),
              loader.loadTestsFromName(modname))
        for subsuite in ss:
            map(suite.addTest, subsuite._tests)
    return suite
コード例 #32
0
ファイル: test_transaction.py プロジェクト: c0ns0le/zenoss-4
def test_suite():
    suite = unittest.TestSuite((
        DocFileSuite('doom.txt'),
        DocTestSuite(),
        unittest.makeSuite(TransactionTests),
        unittest.makeSuite(Test_oid_repr),
        ))
    if sys.version_info >= (2, 6):
        suite.addTest(DocFileSuite('convenience.txt'))

    return suite
コード例 #33
0
def test_suite():
    optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE
    return unittest.TestSuite((
        DocTestSuite('plone.app.vocabularies.terms'),
        DocTestSuite('plone.app.vocabularies.catalog',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.datetimerelated',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.groups',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.language',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.security',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.skins',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.types',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.users',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
        DocTestSuite('plone.app.vocabularies.workflow',
                     setUp=vocabSetUp,
                     tearDown=vocabTearDown,
                     optionflags=optionflags),
    ))
コード例 #34
0
def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(ConcreteHTTPTests),
        unittest.makeSuite(TestHTTPResponse),
        unittest.makeSuite(HTTPInputStreamTests),
        DocTestSuite('zope.publisher.http'),
        DocFileSuite('../httpresults.txt',
                     setUp=cleanUp,
                     tearDown=cleanUp,
                     checker=output_checker),
        unittest.makeSuite(APITests),
    ))
コード例 #35
0
ファイル: fixture.py プロジェクト: davisd50/sparc.testing
 def __new__(cls):
     package = cls.package
     module = cls.module
     
     suite = unittest.TestSuite()
     try:
         docfiletest = DocFileSuite(module+'.txt',
                                             package=import_module(package))
         docfiletest.layer = cls.layer
         suite.addTest(docfiletest)
     except IOError:
         pass # no docfile tests
     
     try:
         if module:
             doctest = DocTestSuite(package+'.'+module)
         else:
             doctest = DocTestSuite(package+'.'+module)
         doctest.layer = cls.layer
         suite.addTest(doctest)
     except ValueError:
         pass # no doc tests
     return suite
コード例 #36
0
def test_suite():
    suite = DocTestSuite('lp.registry.model.projectgroup', setUp=setUp)
    suite.layer = LaunchpadFunctionalLayer
    return suite
コード例 #37
0
def test_suite():
    suite = DocTestSuite()
    suite.addTest(DocTestSuite('zope.proxy.decorator'))
    return suite
コード例 #38
0
def test_suite():
    suite = DocTestSuite(checker=RENormalizing([
        (re.compile(r'Revision="\d+"'), 'Revision="1999"')]))
    suite.layer = LaunchpadFunctionalLayer
    return suite
コード例 #39
0
def test_suite():
    suite = DocTestSuite('lp.services.mail.helpers')
    suite.addTests(unittest.TestLoader().loadTestsFromName(__name__))
    return suite