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

Function test_group_warnings_by_message_summary

testing/test_warnings.py:615–635  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

613
614@pytest.mark.filterwarnings("always::UserWarning")
615def test_group_warnings_by_message_summary(pytester: Pytester) -> None:
616 pytester.copy_example("warnings/test_group_warnings_by_message_summary")
617 pytester.syspathinsert()
618 result = pytester.runpytest()
619 result.stdout.fnmatch_lines(
620 [
621 "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
622 "test_1.py: 21 warnings",
623 "test_2.py: 1 warning",
624 " */test_1.py:7: UserWarning: foo",
625 " warnings.warn(UserWarning(msg))",
626 "",
627 "test_1.py: 20 warnings",
628 " */test_1.py:7: UserWarning: bar",
629 " warnings.warn(UserWarning(msg))",
630 "",
631 "-- Docs: *",
632 "*= 42 passed, 42 warnings *",
633 ],
634 consecutive=True,
635 )
636
637
638def test_pytest_configure_warning(pytester: Pytester, recwarn) -> None:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
copy_exampleMethod · 0.45
syspathinsertMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected