Easier read with _colorama_workaround/_readline_workaround

This commit is contained in:
Daniel Hahler 2019-03-18 01:37:08 +01:00
parent 920bffbfbb
commit 7395501d1d
1 changed files with 10 additions and 14 deletions

View File

@ -706,13 +706,11 @@ def _colorama_workaround():
first import of colorama while I/O capture is active, colorama will first import of colorama while I/O capture is active, colorama will
fail in various ways. fail in various ways.
""" """
if sys.platform.startswith("win32"):
if not sys.platform.startswith("win32"): try:
return import colorama # noqa: F401
try: except ImportError:
import colorama # noqa pass
except ImportError:
pass
def _readline_workaround(): def _readline_workaround():
@ -733,13 +731,11 @@ def _readline_workaround():
See https://github.com/pytest-dev/pytest/pull/1281 See https://github.com/pytest-dev/pytest/pull/1281
""" """
if sys.platform.startswith("win32"):
if not sys.platform.startswith("win32"): try:
return import readline # noqa: F401
try: except ImportError:
import readline # noqa pass
except ImportError:
pass
def _py36_windowsconsoleio_workaround(stream): def _py36_windowsconsoleio_workaround(stream):