Skip to content

Commit 5efe6ab

Browse files
committed
test_log_cli_auto_enable: get stdout once
1 parent ce59f42 commit 5efe6ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

testing/logging/test_reporting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,6 @@ def test_log_cli_auto_enable(testdir, request, cli_args):
635635
"""
636636
testdir.makepyfile(
637637
"""
638-
import pytest
639638
import logging
640639
641640
def test_log_1():
@@ -653,6 +652,7 @@ def test_log_1():
653652
)
654653

655654
result = testdir.runpytest(cli_args)
655+
stdout = result.stdout.str()
656656
if cli_args == "--log-cli-level=WARNING":
657657
result.stdout.fnmatch_lines(
658658
[
@@ -663,13 +663,13 @@ def test_log_1():
663663
"=* 1 passed in *=",
664664
]
665665
)
666-
assert "INFO" not in result.stdout.str()
666+
assert "INFO" not in stdout
667667
else:
668668
result.stdout.fnmatch_lines(
669669
["*test_log_cli_auto_enable*100%*", "=* 1 passed in *="]
670670
)
671-
assert "INFO" not in result.stdout.str()
672-
assert "WARNING" not in result.stdout.str()
671+
assert "INFO" not in stdout
672+
assert "WARNING" not in stdout
673673

674674

675675
def test_log_file_cli(testdir):

0 commit comments

Comments
 (0)