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

Method capwarn

testing/test_warnings.py:658–670  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

656class TestStackLevel:
657 @pytest.fixture
658 def capwarn(self, pytester: Pytester):
659 class CapturedWarnings:
660 captured: List[
661 Tuple[warnings.WarningMessage, Optional[Tuple[str, int, str]]]
662 ] = []
663
664 @classmethod
665 def pytest_warning_recorded(cls, warning_message, when, nodeid, location):
666 cls.captured.append((warning_message, location))
667
668 pytester.plugins = [CapturedWarnings()]
669
670 return CapturedWarnings
671
672 def test_issue4445_rewrite(self, pytester: Pytester, capwarn) -> None:
673 """#4445: Make sure the warning points to a reasonable location

Callers

nothing calls this directly

Calls 1

CapturedWarningsClass · 0.85

Tested by

no test coverage detected