Skip to content

Commit 2c2cf81

Browse files
authored
Merge pull request #2580 from andras-tim/fix-runpytest-subprocess
Avoid interactive pdb when pytest tests itself - fix #2023
2 parents 79097e8 + 50764d9 commit 2c2cf81

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

_pytest/pytester.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,11 @@ def popen(self, cmdargs, stdout, stderr, **kw):
916916
env['PYTHONPATH'] = os.pathsep.join(filter(None, [
917917
str(os.getcwd()), env.get('PYTHONPATH', '')]))
918918
kw['env'] = env
919-
return subprocess.Popen(cmdargs,
920-
stdout=stdout, stderr=stderr, **kw)
919+
920+
popen = subprocess.Popen(cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw)
921+
popen.stdin.close()
922+
923+
return popen
921924

922925
def run(self, *cmdargs):
923926
"""Run a command with arguments.

changelog/2023.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for avoid unwanted interactive ``pdb``

0 commit comments

Comments
 (0)