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

Function test_show_fixtures_with_parameter_ids

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

Source from the content-addressed store, hash-verified

160
161
162def test_show_fixtures_with_parameter_ids(pytester: Pytester, mode) -> None:
163 pytester.makeconftest(
164 '''
165 import pytest
166 @pytest.fixture(
167 scope='session', params=['foo', 'bar'], ids=['spam', 'ham'])
168 def arg_same():
169 """session scoped fixture"""
170 '''
171 )
172 p = pytester.makepyfile(
173 '''
174 import pytest
175 @pytest.fixture(scope='function')
176 def arg_other(arg_same):
177 """function scoped fixture"""
178 def test_arg1(arg_other):
179 pass
180 '''
181 )
182
183 result = pytester.runpytest(mode, p)
184 assert result.ret == 0
185
186 result.stdout.fnmatch_lines(
187 ["SETUP S arg_same?'spam'?", "SETUP S arg_same?'ham'?"]
188 )
189
190
191def test_show_fixtures_with_parameter_ids_function(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