Skip to content

Commit 7395501

Browse files
committed
Easier read with _colorama_workaround/_readline_workaround
1 parent 920bffb commit 7395501

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/_pytest/capture.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -706,13 +706,11 @@ def _colorama_workaround():
706706
first import of colorama while I/O capture is active, colorama will
707707
fail in various ways.
708708
"""
709-
710-
if not sys.platform.startswith("win32"):
711-
return
712-
try:
713-
import colorama # noqa
714-
except ImportError:
715-
pass
709+
if sys.platform.startswith("win32"):
710+
try:
711+
import colorama # noqa: F401
712+
except ImportError:
713+
pass
716714

717715

718716
def _readline_workaround():
@@ -733,13 +731,11 @@ def _readline_workaround():
733731
734732
See https://github.com/pytest-dev/pytest/pull/1281
735733
"""
736-
737-
if not sys.platform.startswith("win32"):
738-
return
739-
try:
740-
import readline # noqa
741-
except ImportError:
742-
pass
734+
if sys.platform.startswith("win32"):
735+
try:
736+
import readline # noqa: F401
737+
except ImportError:
738+
pass
743739

744740

745741
def _py36_windowsconsoleio_workaround(stream):

0 commit comments

Comments
 (0)