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

Function test_show_nested_fixtures

testing/test_setuponly.py:68–99  ·  view source on GitHub ↗
(pytester: Pytester, mode)

Source from the content-addressed store, hash-verified

66
67
68def test_show_nested_fixtures(pytester: Pytester, mode) -> None:
69 pytester.makeconftest(
70 '''
71 import pytest
72 @pytest.fixture(scope='session')
73 def arg_same():
74 """session scoped fixture"""
75 '''
76 )
77 p = pytester.makepyfile(
78 '''
79 import pytest
80 @pytest.fixture(scope='function')
81 def arg_same(arg_same):
82 """function scoped fixture"""
83 def test_arg1(arg_same):
84 pass
85 '''
86 )
87
88 result = pytester.runpytest(mode, p)
89 assert result.ret == 0
90
91 result.stdout.fnmatch_lines(
92 [
93 "SETUP S arg_same*",
94 "*SETUP F arg_same (fixtures used: arg_same)*",
95 "*test_arg1 (fixtures used: arg_same)*",
96 "*TEARDOWN F arg_same*",
97 "TEARDOWN S arg_same*",
98 ]
99 )
100
101
102def test_show_fixtures_with_autouse(pytester: Pytester, mode) -> None:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeconftestMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected