revisit test_root_logger_affected
This commit is contained in:
parent
7da7b9610c
commit
ce59f42ce1
|
@ -67,15 +67,14 @@ def test_root_logger_affected(testdir):
|
||||||
result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log")
|
result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log")
|
||||||
assert result.ret == 1
|
assert result.ret == 1
|
||||||
|
|
||||||
# the capture log calls in the stdout section only contain the
|
# The capture log calls in the stdout section only contain the
|
||||||
# logger.error msg, because --log-level=ERROR
|
# logger.error msg, because of --log-level=ERROR.
|
||||||
result.stdout.fnmatch_lines(["*error text going to logger*"])
|
result.stdout.fnmatch_lines(["*error text going to logger*"])
|
||||||
with pytest.raises(pytest.fail.Exception):
|
stdout = result.stdout.str()
|
||||||
result.stdout.fnmatch_lines(["*warning text going to logger*"])
|
assert "warning text going to logger" not in stdout
|
||||||
with pytest.raises(pytest.fail.Exception):
|
assert "info text going to logger" not in stdout
|
||||||
result.stdout.fnmatch_lines(["*info text going to logger*"])
|
|
||||||
|
|
||||||
# the log file should contain the warning and the error log messages and
|
# The log file should contain the warning and the error log messages and
|
||||||
# not the info one, because the default level of the root logger is
|
# not the info one, because the default level of the root logger is
|
||||||
# WARNING.
|
# WARNING.
|
||||||
assert os.path.isfile(log_file)
|
assert os.path.isfile(log_file)
|
||||||
|
|
Loading…
Reference in New Issue