diff options
author | Daniel Hahler <git@thequod.de> | 2019-03-24 11:22:07 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-03-24 11:22:07 +0100 |
commit | 5efe6ab93c1b1ce74825d540e87e8e72b7f09a1e (patch) | |
tree | 0e71f2d3fd7e1383d45f422cb352f82447280eaf /testing/logging | |
parent | ce59f42ce13c135fe27054c81467755de67268b3 (diff) | |
download | pytest-5efe6ab93c1b1ce74825d540e87e8e72b7f09a1e.tar.gz |
test_log_cli_auto_enable: get stdout once
Diffstat (limited to 'testing/logging')
-rw-r--r-- | testing/logging/test_reporting.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/testing/logging/test_reporting.py b/testing/logging/test_reporting.py index c64c4cb56..f5cd2a2ce 100644 --- a/testing/logging/test_reporting.py +++ b/testing/logging/test_reporting.py @@ -635,7 +635,6 @@ def test_log_cli_auto_enable(testdir, request, cli_args): """ testdir.makepyfile( """ - import pytest import logging def test_log_1(): @@ -653,6 +652,7 @@ def test_log_cli_auto_enable(testdir, request, cli_args): ) result = testdir.runpytest(cli_args) + stdout = result.stdout.str() if cli_args == "--log-cli-level=WARNING": result.stdout.fnmatch_lines( [ @@ -663,13 +663,13 @@ def test_log_cli_auto_enable(testdir, request, cli_args): "=* 1 passed in *=", ] ) - assert "INFO" not in result.stdout.str() + assert "INFO" not in stdout else: result.stdout.fnmatch_lines( ["*test_log_cli_auto_enable*100%*", "=* 1 passed in *="] ) - assert "INFO" not in result.stdout.str() - assert "WARNING" not in result.stdout.str() + assert "INFO" not in stdout + assert "WARNING" not in stdout def test_log_file_cli(testdir): |