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

Function test_terminal_summary_warnings_header_once

testing/test_terminal.py:1658–1679  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1656
1657@pytest.mark.filterwarnings("default::UserWarning")
1658def test_terminal_summary_warnings_header_once(pytester: Pytester) -> None:
1659 pytester.makepyfile(
1660 """
1661 def test_failure():
1662 import warnings
1663 warnings.warn("warning_from_" + "test")
1664 assert 0
1665 """
1666 )
1667 result = pytester.runpytest("-ra")
1668 result.stdout.fnmatch_lines(
1669 [
1670 "*= warnings summary =*",
1671 "*warning_from_test*",
1672 "*= short test summary info =*",
1673 "*== 1 failed, 1 warning in *",
1674 ]
1675 )
1676 result.stdout.no_fnmatch_line("*None*")
1677 stdout = result.stdout.str()
1678 assert stdout.count("warning_from_test") == 1
1679 assert stdout.count("=== warnings summary ") == 1
1680
1681
1682@pytest.mark.filterwarnings("default")

Callers

nothing calls this directly

Calls 6

fnmatch_linesMethod · 0.80
no_fnmatch_lineMethod · 0.80
strMethod · 0.80
countMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected