diff --git a/testing/logging/test_reporting.py b/testing/logging/test_reporting.py index 0bd017057..4f605209c 100644 --- a/testing/logging/test_reporting.py +++ b/testing/logging/test_reporting.py @@ -460,13 +460,6 @@ def test_live_logging_suspends_capture(has_capture_manager, request): from _pytest.capture import CaptureManager from _pytest.logging import _LiveLoggingStreamHandler - if six.PY2: - # need to use the 'generic' StringIO instead of io.StringIO because we might receive both bytes - # and unicode objects; io.StringIO only accepts unicode - from StringIO import StringIO - else: - from io import StringIO - class MockCaptureManager: calls = [] @@ -481,11 +474,11 @@ def test_live_logging_suspends_capture(has_capture_manager, request): assert CaptureManager.resume_global_capture capture_manager = MockCaptureManager() if has_capture_manager else None - out_file = StringIO() + out_file = six.StringIO() handler = _LiveLoggingStreamHandler(out_file, capture_manager) - logger = logging.getLogger(__file__ + '.test_live_logging_suspends_capture') + logger = logging.getLogger(__name__ + '.test_live_logging_suspends_capture') logger.addHandler(handler) request.addfinalizer(partial(logger.removeHandler, handler))