(pytester: Pytester, pyfile_with_warnings, method)
| 87 | |
| 88 | @pytest.mark.parametrize("method", ["cmdline", "ini"]) |
| 89 | def 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"]) |
nothing calls this directly
no test coverage detected