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

Function test_as_errors

testing/test_warnings.py:89–107  ·  view source on GitHub ↗
(pytester: Pytester, pyfile_with_warnings, method)

Source from the content-addressed store, hash-verified

87
88@pytest.mark.parametrize("method", ["cmdline", "ini"])
89def test_as_errors(pytester: Pytester, pyfile_with_warnings, method) -> None:
90 args = ("-W", "error") if method == "cmdline" else ()
91 if method == "ini":
92 pytester.makeini(
93 """
94 [pytest]
95 filterwarnings=error
96 """
97 )
98 # Use a subprocess, since changing logging level affects other threads
99 # (xdist).
100 result = pytester.runpytest_subprocess(*args, pyfile_with_warnings)
101 result.stdout.fnmatch_lines(
102 [
103 "E UserWarning: user warning",
104 "as_errors_module.py:3: UserWarning",
105 "* 1 failed in *",
106 ]
107 )
108
109
110@pytest.mark.parametrize("method", ["cmdline", "ini"])

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makeiniMethod · 0.45
runpytest_subprocessMethod · 0.45

Tested by

no test coverage detected