from doctest import ELLIPSIS

import pytest

from sybil import Sybil
try:     # sybil >= 3
    from sybil.parsers.codeblock import PythonCodeBlockParser
except ImportError:  # sybil < 3
    from sybil.parsers.codeblock import CodeBlockParser as PythonCodeBlockParser
from sybil.parsers.doctest import DocTestParser
from sybil.parsers.skip import skip

pytest_collect_file = Sybil(
    parsers=[
        DocTestParser(optionflags=ELLIPSIS),
        PythonCodeBlockParser(),
        skip,
    ],
    pattern='*.rst',
).pytest()
