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

Method test_funcarg_lookup_error

testing/python/fixtures.py:585–621  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

583 assert result.ret == 0
584
585 def test_funcarg_lookup_error(self, pytester: Pytester) -> None:
586 pytester.makeconftest(
587 """
588 import pytest
589
590 @pytest.fixture
591 def a_fixture(): pass
592
593 @pytest.fixture
594 def b_fixture(): pass
595
596 @pytest.fixture
597 def c_fixture(): pass
598
599 @pytest.fixture
600 def d_fixture(): pass
601 """
602 )
603 pytester.makepyfile(
604 """
605 def test_lookup_error(unknown):
606 pass
607 """
608 )
609 result = pytester.runpytest()
610 result.stdout.fnmatch_lines(
611 [
612 "*ERROR at setup of test_lookup_error*",
613 " def test_lookup_error(unknown):*",
614 "E fixture 'unknown' not found",
615 "> available fixtures:*a_fixture,*b_fixture,*c_fixture,*d_fixture*monkeypatch,*",
616 # sorted
617 "> use 'py*test --fixtures *' for help on them.",
618 "*1 error*",
619 ]
620 )
621 result.stdout.no_fnmatch_line("*INTERNAL*")
622
623 def test_fixture_excinfo_leak(self, pytester: Pytester) -> None:
624 # on python2 sys.excinfo would leak into fixture executions

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected