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

Function test_yield_fixture_with_no_value

testing/python/fixtures.py:4457–4474  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

4455
4456
4457def test_yield_fixture_with_no_value(pytester: Pytester) -> None:
4458 pytester.makepyfile(
4459 """
4460 import pytest
4461 @pytest.fixture(name='custom')
4462 def empty_yield():
4463 if False:
4464 yield
4465
4466 def test_fixt(custom):
4467 pass
4468 """
4469 )
4470 expected = "E ValueError: custom did not yield a value"
4471 result = pytester.runpytest()
4472 result.assert_outcomes(errors=1)
4473 result.stdout.fnmatch_lines([expected])
4474 assert result.ret == ExitCode.TESTS_FAILED

Callers

nothing calls this directly

Calls 4

assert_outcomesMethod · 0.80
fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected