MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_fixtures_in_module

Function test_fixtures_in_module

testing/python/show_fixtures_per_test.py:10–36  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

8
9
10def test_fixtures_in_module(pytester: Pytester) -> None:
11 p = pytester.makepyfile(
12 '''
13 import pytest
14 @pytest.fixture
15 def _arg0():
16 """hidden arg0 fixture"""
17 @pytest.fixture
18 def arg1():
19 """arg1 docstring"""
20 def test_arg1(arg1):
21 pass
22 '''
23 )
24
25 result = pytester.runpytest("--fixtures-per-test", p)
26 assert result.ret == 0
27
28 result.stdout.fnmatch_lines(
29 [
30 "*fixtures used by test_arg1*",
31 "*(test_fixtures_in_module.py:9)*",
32 "arg1 -- test_fixtures_in_module.py:6",
33 " arg1 docstring",
34 ]
35 )
36 result.stdout.no_fnmatch_line("*_arg0*")
37
38
39def test_fixtures_in_conftest(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
no_fnmatch_lineMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected