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

Function test_group_warnings_by_message

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

Source from the content-addressed store, hash-verified

582
583@pytest.mark.filterwarnings("always::UserWarning")
584def test_group_warnings_by_message(pytester: Pytester) -> None:
585 pytester.copy_example("warnings/test_group_warnings_by_message.py")
586 result = pytester.runpytest()
587 result.stdout.fnmatch_lines(
588 [
589 "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
590 "test_group_warnings_by_message.py::test_foo[[]0[]]",
591 "test_group_warnings_by_message.py::test_foo[[]1[]]",
592 "test_group_warnings_by_message.py::test_foo[[]2[]]",
593 "test_group_warnings_by_message.py::test_foo[[]3[]]",
594 "test_group_warnings_by_message.py::test_foo[[]4[]]",
595 "test_group_warnings_by_message.py::test_foo_1",
596 " */test_group_warnings_by_message.py:*: UserWarning: foo",
597 " warnings.warn(UserWarning(msg))",
598 "",
599 "test_group_warnings_by_message.py::test_bar[[]0[]]",
600 "test_group_warnings_by_message.py::test_bar[[]1[]]",
601 "test_group_warnings_by_message.py::test_bar[[]2[]]",
602 "test_group_warnings_by_message.py::test_bar[[]3[]]",
603 "test_group_warnings_by_message.py::test_bar[[]4[]]",
604 " */test_group_warnings_by_message.py:*: UserWarning: bar",
605 " warnings.warn(UserWarning(msg))",
606 "",
607 "-- Docs: *",
608 "*= 11 passed, 11 warnings *",
609 ],
610 consecutive=True,
611 )
612
613
614@pytest.mark.filterwarnings("always::UserWarning")

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
copy_exampleMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected