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

Function test_normal_flow

testing/test_warnings.py:42–55  ·  view source on GitHub ↗

Check that the warnings section is displayed.

(pytester: Pytester, pyfile_with_warnings)

Source from the content-addressed store, hash-verified

40
41@pytest.mark.filterwarnings("default::UserWarning", "default::RuntimeWarning")
42def test_normal_flow(pytester: Pytester, pyfile_with_warnings) -> None:
43 """Check that the warnings section is displayed."""
44 result = pytester.runpytest(pyfile_with_warnings)
45 result.stdout.fnmatch_lines(
46 [
47 "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
48 "test_normal_flow.py::test_func",
49 "*normal_flow_module.py:3: UserWarning: user warning",
50 '* warnings.warn(UserWarning("user warning"))',
51 "*normal_flow_module.py:4: RuntimeWarning: runtime warning",
52 '* warnings.warn(RuntimeWarning("runtime warning"))',
53 "* 1 passed, 2 warnings*",
54 ]
55 )
56
57
58@pytest.mark.filterwarnings("always::UserWarning")

Callers

nothing calls this directly

Calls 2

fnmatch_linesMethod · 0.80
runpytestMethod · 0.45

Tested by

no test coverage detected