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


Python doctest.DocFileSuite方法代码示例

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


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

示例1: test_suite

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def test_suite():
    """Simple tes suite"""

    globs = {}
    try:
        from pprint import pprint
        globs['pprint'] = pprint
    except Exception:
        pass
    try:
        from interlude import interact
        globs['interact'] = interact
    except Exception:
        pass

    return unittest.TestSuite([
        doctest.DocFileSuite(
            file,
            optionflags=optionflags,
            globs=globs,
        ) for file in TESTFILES
    ]) 
开发者ID:Yukinoshita47,项目名称:Yuki-Chan-The-Auto-Pentest,代码行数:24,代码来源:tests.py

示例2: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=blocks.__path__,
                                              prefix=blocks.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL))
        except:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(blocks.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL))

    return tests 
开发者ID:rizar,项目名称:attention-lvcsr,代码行数:25,代码来源:__init__.py

示例3: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=fuel.__path__,
                                              prefix=fuel.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
                checker=Py23DocChecker()))
        except:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(fuel.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
        checker=Py23DocChecker()))

    return tests 
开发者ID:rizar,项目名称:attention-lvcsr,代码行数:27,代码来源:__init__.py

示例4: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    env = os.environ.copy()
    env['CR8_NO_TQDM'] = 'True'
    node.start()
    assert node.http_host, "http_url must be available"
    tests.addTests(doctest.DocFileSuite(
        os.path.join('..', 'README.rst'),
        globs={
            'sh': functools.partial(
                subprocess.run,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                timeout=60,
                shell=True,
                env=env
            )
        },
        optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
        setUp=setup,
        tearDown=teardown,
        parser=Parser()
    ))
    return tests 
开发者ID:mfussenegger,项目名称:cr8,代码行数:26,代码来源:test_integration.py

示例5: build_suite

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def build_suite(suite, names):
    # Determine the root directory of the source code files.  This is
    #  used for finding doctest files specified relative to that root.
    project_root = os.path.join(os.path.dirname(__file__), "..", "..")
    project_root = os.path.abspath(project_root)

    # Load test cases from specified names.
    loader = unittest.defaultTestLoader
    for name in names:
        if name.startswith("."):
            name = "dragonfly.test" + name
            suite.addTests(loader.loadTestsFromName(name))
        elif name.startswith("doc:"):
            path = name[4:]
            path = os.path.join(project_root, *path.split("/"))
            path = os.path.abspath(path)
            suite.addTests(doctest.DocFileSuite(path))
        else:
            raise Exception("Invalid test name: %r." % (name,))
    return suite 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:22,代码来源:suites.py

示例6: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=fuel.__path__,
                                              prefix=fuel.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
                checker=Py23DocChecker()))
        except Exception:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(fuel.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
        checker=Py23DocChecker()))

    return tests 
开发者ID:mila-iqia,项目名称:fuel,代码行数:27,代码来源:__init__.py

示例7: test_suite

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def test_suite():
    suite = unittest.makeSuite(InterfaceTests)
    suite.addTest(doctest.DocTestSuite("zope.interface.interface"))
    if sys.version_info >= (2, 4):
        suite.addTest(doctest.DocTestSuite())
    suite.addTest(doctest.DocFileSuite(
        '../README.txt',
        globs={'__name__': '__main__'},
        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
        ))
    suite.addTest(doctest.DocFileSuite(
        '../README.ru.txt',
        globs={'__name__': '__main__'},
        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
        ))
    return suite 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:18,代码来源:test_interface.py

示例8: additional_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    try:
        import doctest
    except ImportError:
        if sys.version_info < (2, 7):
            # doctests in 2.6 depends on cStringIO
            return suite
        raise
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
开发者ID:Tautulli,项目名称:Tautulli,代码行数:19,代码来源:__init__.py

示例9: additional_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def additional_tests():
    #print "here-000000000000000"
    #print "-----", glob(os.path.join(os.path.dirname(__file__), '*.doctest'))
    dir = os.path.dirname(__file__)
    paths = glob(os.path.join(dir, '*.doctest'))
    files = [ os.path.basename(path) for path in paths ]
    return unittest.TestSuite(
        [ doctest.DocFileSuite(file) for file in files ]
        )
#if os.path.split(path)[-1] != 'index.rst'
# skips time-dependent doctest in index.rst 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:13,代码来源:all.py

示例10: additional_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:12,代码来源:__init__.py

示例11: additional_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def additional_tests():
    import doctest, unittest
    suite = unittest.TestSuite((
        doctest.DocFileSuite(
            os.path.join('tests', 'api_tests.txt'),
            optionflags=doctest.ELLIPSIS, package='pkg_resources',
            ),
        ))
    if sys.platform == 'win32':
        suite.addTest(doctest.DocFileSuite('win_script_wrapper.txt'))
    return suite 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:13,代码来源:__init__.py

示例12: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    cd = ChdirTemp()
    tests.addTests(
        doctest.DocFileSuite(
            "../README.md",
            parser=ReadmeTestParser(),
            optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE,
            setUp=cd.setUp,
            tearDown=cd.tearDown,
        )
    )
    return tests 
开发者ID:EmilStenstrom,项目名称:conllu,代码行数:14,代码来源:test_readme.py

示例13: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    for root, dirs, files in os.walk("."):
        if "venv" not in root:
            for f in files:
                if f.endswith(".rst") or f.endswith(".md"):
                    tests.addTests(
                        doctest.DocFileSuite(
                            os.path.join(root, f), optionflags=doctest.ELLIPSIS
                        )
                    )

    return tests 
开发者ID:drvinceknight,项目名称:Nashpy,代码行数:14,代码来源:doctests.py

示例14: test_main

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def test_main():
    from doctest import DocFileSuite
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(MathTests))
    suite.addTest(DocFileSuite("ieee754.txt"))
    run_unittest(suite) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_math.py

示例15: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import DocFileSuite [as 别名]
def load_tests(loader, tests, ignore):
    tests.addTests(doctest.DocFileSuite('../../../../README.rst'))
    return tests 
开发者ID:thegaragelab,项目名称:gctools,代码行数:5,代码来源:test_doc.py


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