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):
3131
3232@pytest .hookimpl (hookwrapper = True )
3333def pytest_load_initial_conftests (early_config , parser , args ):
34+ _readline_workaround ()
3435 ns = early_config .known_args_namespace
3536 pluginmanager = early_config .pluginmanager
3637 capman = CaptureManager (ns .capture )
@@ -307,8 +308,7 @@ class NoCapture:
307308class FDCapture :
308309 """ Capture IO to/from a given os-level filedescriptor. """
309310
310- def __init__ (self , targetfd , tmpfile = None ):
311- readline_workaround ()
311+ def __init__ (self , targetfd , tmpfile = None ):
312312 self .targetfd = targetfd
313313 try :
314314 self .targetfd_save = os .dup (self .targetfd )
@@ -445,7 +445,7 @@ def close(self):
445445 pass
446446
447447
448- def readline_workaround ():
448+ def _readline_workaround ():
449449 """
450450 Ensure readline is imported so that it attaches to the correct stdio
451451 handles on Windows.
@@ -464,6 +464,8 @@ def readline_workaround():
464464 See https://github.com/pytest-dev/pytest/pull/1281
465465 """
466466
467+ if not sys .platform .startswith ('win32' ):
468+ return
467469 try :
468470 import readline # noqa
469471 except ImportError :
You can’t perform that action at this time.
0 commit comments