Skip to content

Commit ce59f42

Browse files
committed
revisit test_root_logger_affected
1 parent 7da7b96 commit ce59f42

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

testing/logging/test_reporting.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ def test_foo():
6767
result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log")
6868
assert result.ret == 1
6969

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.
7272
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
7776

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
7978
# not the info one, because the default level of the root logger is
8079
# WARNING.
8180
assert os.path.isfile(log_file)

0 commit comments

Comments
 (0)