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

Function test_pytester_assert_outcomes_warnings

testing/test_pytester.py:827–839  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

825
826@pytest.mark.filterwarnings("default")
827def test_pytester_assert_outcomes_warnings(pytester: Pytester) -> None:
828 pytester.makepyfile(
829 """
830 import warnings
831
832 def test_with_warning():
833 warnings.warn(UserWarning("some custom warning"))
834 """
835 )
836 result = pytester.runpytest()
837 result.assert_outcomes(passed=1, warnings=1)
838 # If warnings is not passed, it is not checked at all.
839 result.assert_outcomes(passed=1)
840
841
842def test_pytester_outcomes_deselected(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected