diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 658632e00..3147d9728 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -14,7 +14,7 @@ from tempfile import TemporaryFile import six import pytest -from _pytest.compat import CaptureIO, dummy_context_manager +from _pytest.compat import CaptureIO patchsysdict = {0: "stdin", 1: "stdout", 2: "stderr"} @@ -759,4 +759,3 @@ def _attempt_to_close_capture_file(f): pass else: f.close() - diff --git a/testing/logging/test_reporting.py b/testing/logging/test_reporting.py index b8fc371d4..363982cf9 100644 --- a/testing/logging/test_reporting.py +++ b/testing/logging/test_reporting.py @@ -878,7 +878,6 @@ def test_live_logging_suspends_capture(has_capture_manager, request): import logging import contextlib from functools import partial - from _pytest.capture import CaptureManager from _pytest.logging import _LiveLoggingStreamHandler class MockCaptureManager: diff --git a/testing/test_capture.py b/testing/test_capture.py index 626c4414a..ec8c682e2 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -1396,7 +1396,8 @@ def test_capture_with_live_logging(testdir): # capture should work with live cli logging # Teardown report seems to have the capture for the whole process (setup, capture, teardown) - testdir.makeconftest(""" + testdir.makeconftest( + """ def pytest_runtest_logreport(report): if "test_global" in report.nodeid: if report.when == "teardown": @@ -1404,7 +1405,8 @@ def test_capture_with_live_logging(testdir): f.write(report.caplog) with open("capstdout", "w") as f: f.write(report.capstdout) - """) + """ + ) testdir.makepyfile( """ @@ -1413,7 +1415,7 @@ def test_capture_with_live_logging(testdir): import pytest logger = logging.getLogger(__name__) - + @pytest.fixture def fix1(): print("fix setup")