forked from pytest-dev/pytest-asyncio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_doctest.py
39 lines (32 loc) · 1 KB
/
test_doctest.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
38
39
from textwrap import dedent
from pytest import Pytester
def test_plugin_does_not_interfere_with_doctest_collection(pytester: Pytester):
pytester.makepyfile(
dedent(
'''\
def any_function():
"""
>>> 42
42
"""
'''
),
)
result = pytester.runpytest("--asyncio-mode=strict", "--doctest-modules")
result.assert_outcomes(passed=1)
def test_plugin_does_not_interfere_with_doctest_textfile_collection(pytester: Pytester):
pytester.makefile(".txt", "") # collected as DoctestTextfile
pytester.makepyfile(
__init__="",
test_python_file=dedent(
"""\
import pytest
pytest_plugins = "pytest_asyncio"
@pytest.mark.asyncio
async def test_anything():
pass
"""
),
)
result = pytester.runpytest("--asyncio-mode=strict")
result.assert_outcomes(passed=1)