File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -67,15 +67,14 @@ def test_foo():
67
67
result = testdir .runpytest ("--log-level=ERROR" , "--log-file=pytest.log" )
68
68
assert result .ret == 1
69
69
70
- # the capture log calls in the stdout section only contain the
71
- # logger.error msg, because --log-level=ERROR
70
+ # The capture log calls in the stdout section only contain the
71
+ # logger.error msg, because of --log-level=ERROR.
72
72
result .stdout .fnmatch_lines (["*error text going to logger*" ])
73
- with pytest .raises (pytest .fail .Exception ):
74
- result .stdout .fnmatch_lines (["*warning text going to logger*" ])
75
- with pytest .raises (pytest .fail .Exception ):
76
- result .stdout .fnmatch_lines (["*info text going to logger*" ])
73
+ stdout = result .stdout .str ()
74
+ assert "warning text going to logger" not in stdout
75
+ assert "info text going to logger" not in stdout
77
76
78
- # the log file should contain the warning and the error log messages and
77
+ # The log file should contain the warning and the error log messages and
79
78
# not the info one, because the default level of the root logger is
80
79
# WARNING.
81
80
assert os .path .isfile (log_file )
You can’t perform that action at this time.
0 commit comments