File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ def pytest_addoption(parser):
31
31
32
32
@pytest .hookimpl (hookwrapper = True )
33
33
def pytest_load_initial_conftests (early_config , parser , args ):
34
+ _readline_workaround ()
34
35
ns = early_config .known_args_namespace
35
36
pluginmanager = early_config .pluginmanager
36
37
capman = CaptureManager (ns .capture )
@@ -307,8 +308,7 @@ class NoCapture:
307
308
class FDCapture :
308
309
""" Capture IO to/from a given os-level filedescriptor. """
309
310
310
- def __init__ (self , targetfd , tmpfile = None ):
311
- readline_workaround ()
311
+ def __init__ (self , targetfd , tmpfile = None ):
312
312
self .targetfd = targetfd
313
313
try :
314
314
self .targetfd_save = os .dup (self .targetfd )
@@ -445,7 +445,7 @@ def close(self):
445
445
pass
446
446
447
447
448
- def readline_workaround ():
448
+ def _readline_workaround ():
449
449
"""
450
450
Ensure readline is imported so that it attaches to the correct stdio
451
451
handles on Windows.
@@ -464,6 +464,8 @@ def readline_workaround():
464
464
See https://github.com/pytest-dev/pytest/pull/1281
465
465
"""
466
466
467
+ if not sys .platform .startswith ('win32' ):
468
+ return
467
469
try :
468
470
import readline # noqa
469
471
except ImportError :
You can’t perform that action at this time.
0 commit comments