示例#1
0
            raise AssertionError(msg)
        return rendered

    return _make_filter_test_template


_sy = Sybil(
    parsers=[
        DocTestParser(optionflags=ELLIPSIS),
        CodeBlockParser(),
    ],
    pattern='**/*',
    excludes=[
        '**/markupsafe/*',
        '**/jinja2/*',
        '**/static/*',
        '**/.*/*',
        '**/.*',
        '**/CONTRIBUTING.rst',
        '**/verification/*',
        '**/prof/*'
    ],
    fixtures=['jinja_filter_tester',
              'gen_paths',
              'assert_language_config_value',
              'configurable_language_context_factory']
)


pytest_collect_file = _sy.pytest()
示例#2
0
Enable pytest integration of doctests in source and/or in documentation.
"""

import fnmatch

from sybil import Sybil
from sybil.parsers.codeblock import CodeBlockParser
from sybil.parsers.doctest import DocTestParser

s = Sybil(
    parsers=[
        DocTestParser(),
        CodeBlockParser(),
    ],
    excludes=['test/fixtues/*'],
)


class _ReplacementSybilFilter:
    """
    Sybil's matcher isn't very good so we replace it with our own.
    """
    def __call__(self: Sybil, filename: str) -> bool:
        return fnmatch.fnmatch(filename, '*.rst') or fnmatch.fnmatch(
            filename, '*.py')


s.should_test_filename = _ReplacementSybilFilter()

pytest_collect_file = s.pytest()