forked from pytest-dev/pytest-asyncio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_shared_module_fixture.py
35 lines (32 loc) · 1.06 KB
/
test_shared_module_fixture.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
from textwrap import dedent
from pytest import Pytester
def test_asyncio_mark_provides_package_scoped_loop_strict_mode(pytester: Pytester):
pytester.makepyfile(
__init__="",
conftest=dedent(
"""\
import pytest_asyncio
@pytest_asyncio.fixture(scope="module")
async def async_shared_module_fixture():
return True
"""
),
test_module_one=dedent(
"""\
import pytest
@pytest.mark.asyncio
async def test_shared_module_fixture_use_a(async_shared_module_fixture):
assert async_shared_module_fixture is True
"""
),
test_module_two=dedent(
"""\
import pytest
@pytest.mark.asyncio
async def test_shared_module_fixture_use_b(async_shared_module_fixture):
assert async_shared_module_fixture is True
"""
),
)
result = pytester.runpytest("--asyncio-mode=strict")
result.assert_outcomes(passed=2)