diff --git a/AUTHORS b/AUTHORS index ca282870fb9..2ffab85cb80 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,6 +9,7 @@ Ahn Ki-Wook Alexander Johnson Alexei Kozlenok Anatoly Bubenkoff +Andras Tim Andreas Zeidler Andrzej Ostrowski Andy Freeland diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 901caa340b8..ac5a88c7063 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -908,8 +908,11 @@ def popen(self, cmdargs, stdout, stderr, **kw): env['PYTHONPATH'] = os.pathsep.join(filter(None, [ str(os.getcwd()), env.get('PYTHONPATH', '')])) kw['env'] = env - return subprocess.Popen(cmdargs, - stdout=stdout, stderr=stderr, **kw) + + popen = subprocess.Popen(cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw) + popen.stdin.close() + + return popen def run(self, *cmdargs): """Run a command with arguments. diff --git a/changelog/2023.bugfix b/changelog/2023.bugfix new file mode 100644 index 00000000000..acf4b405bf9 --- /dev/null +++ b/changelog/2023.bugfix @@ -0,0 +1 @@ +Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for avoid unwanted interactive ``pdb``