def suiteFromPackage(name):
    files = resource_listdir(__name__, name)
    suite = unittest.TestSuite()
    for filename in files:
        if not filename.endswith('.py'):
            continue
        if filename == '__init__.py':
            continue
        if filename[0] in ('.', '#'):
            # Some editor create temporary files which can be
            # annoying.
            continue

        dottedname = 'five.grok.ftests.%s.%s' % (name, filename[:-3])
        test = FunctionalDocTestSuite(
            dottedname,
            extraglobs=dict(getRootFolder=getRootFolder,
                            sync=sync),
            optionflags=(doctest.ELLIPSIS+
                         doctest.NORMALIZE_WHITESPACE+
                         doctest.REPORT_NDIFF))
        test.layer = FunctionalLayer

        suite.addTest(test)
    return suite
Exemple #2
0
def test_suite():
    suite = unittest.TestSuite()

    for name in ['adapters', 'annotation', 'multiadapter', 'utilities',
                 'subscribers']:
        test = FunctionalDocTestSuite(
            module='five.grok.tests.%s' % name,
            optionflags=options)
        test.layer = FunctionalLayer
        suite.addTest(test)
    return suite
def suiteFromPackage(name):
    files = resource_listdir(__name__, name)
    suite = unittest.TestSuite()
    for filename in files:
        if not filename.endswith('.py'):
            continue
        if filename == '__init__.py':
            continue

        dottedname = 'five.megrok.z3cpt.ftests.%s.%s' % (name, filename[:-3])
        test = FunctionalDocTestSuite(
            dottedname,
            extraglobs=dict(http=HTTPCaller(),
                            http_call=http_call,
                            getRootFolder=getRootFolder,
                            sync=sync),
            optionflags=(doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE +
                         doctest.REPORT_NDIFF))
        test.layer = GrokFunctionalLayer

        suite.addTest(test)
    return suite