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

Function test_show_fixtures_with_parameters

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

Source from the content-addressed store, hash-verified

127
128
129def test_show_fixtures_with_parameters(pytester: Pytester, mode) -> None:
130 pytester.makeconftest(
131 '''
132 import pytest
133 @pytest.fixture(scope='session', params=['foo', 'bar'])
134 def arg_same():
135 """session scoped fixture"""
136 '''
137 )
138 p = pytester.makepyfile(
139 '''
140 import pytest
141 @pytest.fixture(scope='function')
142 def arg_other(arg_same):
143 """function scoped fixture"""
144 def test_arg1(arg_other):
145 pass
146 '''
147 )
148
149 result = pytester.runpytest(mode, p)
150 assert result.ret == 0
151
152 result.stdout.fnmatch_lines(
153 [
154 "SETUP S arg_same?'foo'?",
155 "TEARDOWN S arg_same?'foo'?",
156 "SETUP S arg_same?'bar'?",
157 "TEARDOWN S arg_same?'bar'?",
158 ]
159 )
160
161
162def test_show_fixtures_with_parameter_ids(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