(pytester: Pytester)
| 1656 | |
| 1657 | @pytest.mark.filterwarnings("default::UserWarning") |
| 1658 | def 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") |
nothing calls this directly
no test coverage detected