Skip to content

Commit 1cb70fc

Browse files
committed
tests: win: don't cleanup processes on Popen
Workaround for two bugs: https://bugs.python.org/issue37380 and gitpython-developers/GitPython#546 Signed-off-by: Ruslan Kuprieiev <[email protected]>
1 parent 2a4d622 commit 1cb70fc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/.basic_env.py.un~

-11.6 KB
Binary file not shown.

tests/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,30 @@
33
# Increasing fd ulimit for tests
44
if os.name == "nt":
55
import win32file
6+
import subprocess
67

78
win32file._setmaxstdio(2048)
9+
10+
# Workaround for two bugs:
11+
#
12+
# 1) gitpython-developers/GitPython#546
13+
# GitPython leaves git cat-file --batch/--batch-check processes that are
14+
# not cleaned up correctly, so Popen._active list has their defunct
15+
# process handles, that it is not able to cleanup because of bug 2)
16+
#
17+
# 2) https://bugs.python.org/issue37380
18+
# subprocess.Popen._internal_poll on windows is getting
19+
#
20+
# OSError: [WinError 6] The handle is invalid
21+
#
22+
# exception, which it doesn't ignore and so Popen is not able to cleanup
23+
# old processes and that prevents it from creating any new processes at
24+
# all, which results in our tests failing whenever they try to use Popen.
25+
26+
def noop():
27+
pass
28+
29+
subprocess._cleanup = noop
830
else:
931
import resource
1032

0 commit comments

Comments
 (0)