Apply readline workaround during initial conftest loading
This commit is contained in:
parent
6e170a4a1c
commit
57bc14caa0
|
@ -31,6 +31,7 @@ def pytest_addoption(parser):
|
|||
|
||||
@pytest.hookimpl(hookwrapper=True)
|
||||
def pytest_load_initial_conftests(early_config, parser, args):
|
||||
_readline_workaround()
|
||||
ns = early_config.known_args_namespace
|
||||
pluginmanager = early_config.pluginmanager
|
||||
capman = CaptureManager(ns.capture)
|
||||
|
@ -308,7 +309,6 @@ class FDCapture:
|
|||
""" Capture IO to/from a given os-level filedescriptor. """
|
||||
|
||||
def __init__(self, targetfd, tmpfile=None):
|
||||
readline_workaround()
|
||||
self.targetfd = targetfd
|
||||
try:
|
||||
self.targetfd_save = os.dup(self.targetfd)
|
||||
|
@ -445,7 +445,7 @@ class DontReadFromInput:
|
|||
pass
|
||||
|
||||
|
||||
def readline_workaround():
|
||||
def _readline_workaround():
|
||||
"""
|
||||
Ensure readline is imported so that it attaches to the correct stdio
|
||||
handles on Windows.
|
||||
|
@ -464,6 +464,8 @@ 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:
|
||||
|
|
Loading…
Reference in New Issue