-
Notifications
You must be signed in to change notification settings - Fork 6
/
conftest.py
37 lines (28 loc) · 861 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from doctest import REPORT_NDIFF, ELLIPSIS
import pytest
from pyfakefs.pytest_plugin import fs_module as fs
from sybil import Sybil
from sybil.parsers.doctest import DocTestParser
from sybil.parsers.codeblock import PythonCodeBlockParser
from testfixtures import Replacer, TempDirectory
from testfixtures.sybil import FileParser
@pytest.fixture()
def tempdir(fs):
with TempDirectory(path='/') as d:
yield d
@pytest.fixture(scope='module')
def replace():
with Replacer() as replace:
yield replace
@pytest.fixture()
def skip_no_yaml():
pytest.importorskip("yaml")
pytest_collect_file = Sybil(
parsers=[
DocTestParser(optionflags=REPORT_NDIFF|ELLIPSIS),
PythonCodeBlockParser(),
FileParser('tempdir')
],
pattern='*.rst',
fixtures=['fs', 'replace', 'tempdir', 'skip_no_yaml'],
).pytest()