Avoid interactive pdb when pytest tests itself - fix #2023

The debugging.py calls post_mortem() on error and pdb will drops an
interactive debugger when the stdin is a readable fd.
This commit is contained in:
Andras Tim 2017-07-21 21:27:48 +02:00
parent 1cf826624e
commit 50764d9ebb
2 changed files with 6 additions and 2 deletions

View File

@ -916,8 +916,11 @@ class Testdir:
env['PYTHONPATH'] = os.pathsep.join(filter(None, [ env['PYTHONPATH'] = os.pathsep.join(filter(None, [
str(os.getcwd()), env.get('PYTHONPATH', '')])) str(os.getcwd()), env.get('PYTHONPATH', '')]))
kw['env'] = env 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): def run(self, *cmdargs):
"""Run a command with arguments. """Run a command with arguments.

1
changelog/2023.bugfix Normal file
View File

@ -0,0 +1 @@
Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for avoid unwanted interactive ``pdb``