From 7395501d1d3074a0f9f723a66c1616b24769f310 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 18 Mar 2019 01:37:08 +0100 Subject: [PATCH] Easier read with _colorama_workaround/_readline_workaround --- src/_pytest/capture.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 867b976b5..c6f834545 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -706,13 +706,11 @@ def _colorama_workaround(): first import of colorama while I/O capture is active, colorama will fail in various ways. """ - - if not sys.platform.startswith("win32"): - return - try: - import colorama # noqa - except ImportError: - pass + if sys.platform.startswith("win32"): + try: + import colorama # noqa: F401 + except ImportError: + pass def _readline_workaround(): @@ -733,13 +731,11 @@ def _readline_workaround(): See https://github.com/pytest-dev/pytest/pull/1281 """ - - if not sys.platform.startswith("win32"): - return - try: - import readline # noqa - except ImportError: - pass + if sys.platform.startswith("win32"): + try: + import readline # noqa: F401 + except ImportError: + pass def _py36_windowsconsoleio_workaround(stream):