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

Function test_dynamic_fixture_request

testing/test_setuponly.py:211–234  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

209
210
211def test_dynamic_fixture_request(pytester: Pytester) -> None:
212 p = pytester.makepyfile(
213 """
214 import pytest
215 @pytest.fixture()
216 def dynamically_requested_fixture():
217 pass
218 @pytest.fixture()
219 def dependent_fixture(request):
220 request.getfixturevalue('dynamically_requested_fixture')
221 def test_dyn(dependent_fixture):
222 pass
223 """
224 )
225
226 result = pytester.runpytest("--setup-only", p)
227 assert result.ret == 0
228
229 result.stdout.fnmatch_lines(
230 [
231 "*SETUP F dynamically_requested_fixture",
232 "*TEARDOWN F dynamically_requested_fixture",
233 ]
234 )
235
236
237def test_capturing(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected