From 1cb70fc63130d1fb9c4bca09d4534bd3237124d4 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 23 Jun 2019 21:46:41 +0300 Subject: [PATCH] tests: win: don't cleanup processes on Popen Workaround for two bugs: https://bugs.python.org/issue37380 and https://github.com/gitpython-developers/GitPython/issues/546 Signed-off-by: Ruslan Kuprieiev --- tests/.basic_env.py.un~ | Bin 11837 -> 0 bytes tests/__init__.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) delete mode 100644 tests/.basic_env.py.un~ diff --git a/tests/.basic_env.py.un~ b/tests/.basic_env.py.un~ deleted file mode 100644 index bc48da4dd76f85edeb0dbe7714a4e988b8bd2a5a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11837 zcmeI&%WD%s90%}CZH>?PtXc}P)K?27KI^-e(u)cr_&{4~t#(6G8&@`oSj0mQ{s|t% zyLj{9zv0zCK<&wcT2F%hzOysoXPf*+kl$?vrZbx~yR*MfX0tQ1x2m<*Hy@3spQ5h# zWBTIl-SJEPeaofZ{qKs4za|SS>Dc?vm&aZ%|9*8PiVEAJD7qN4^f*f@)u*F*F&x*M z6>R3ka6DVhM(@wmlWD3X4;pEKj2+TU3p>t z;;o02cVX){C9^ARgrpFGsnX0k!xHnvLp0Ijc3YBpIwH z3zhP8mZlAS1BOPHj3+*{j!K_2-FGO49cl33`L(CcCCg>2Ad0nx4cG!L)U6fl9eo;4V-0h0wpx9Y<@v=+1T z?7V<<&qc+_Od}qWXBp{*~A(FGWx$f1tu2>t&*7T8K&->2|Z+Q z8z!)9W{m*Z9m?if8JJjPRH`)N^3^c)$oUa&DHv*YOOFt&CHxV6KDrvT~@YtpYVA>*fSSzfdPtn zeV2e8fL%1yOCRt#30PcfvA*!!&Q1f?!IuR@x9amfEBO8kFF1FwQvh|~WdYHx`gqR> zywXCc?Yz)5%PICOARTmdN!i|gx~BzQVHMos0@EyF+am%x;Ii=RRtfiqbn`qS;C6n( z!P>&IH6KWII0su@P_}oU?J2?542;@6ykcqXTx08KU=FmcaA;S2v?m2xjEDqTNbX_n z$4qgMWdYHx`eaW?vLY-XY2LY&fE-|3;n1%5V2=y1qAMKnOqxqD4z4a5>ZQ;1nBXd1 zhrx))L0tlIV0F<@FMX`7C2lxa&(2W diff --git a/tests/__init__.py b/tests/__init__.py index 6b7358582..434d8c2e2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,8 +3,30 @@ import os # Increasing fd ulimit for tests if os.name == "nt": import win32file + import subprocess win32file._setmaxstdio(2048) + + # Workaround for two bugs: + # + # 1) gitpython-developers/GitPython#546 + # GitPython leaves git cat-file --batch/--batch-check processes that are + # not cleaned up correctly, so Popen._active list has their defunct + # process handles, that it is not able to cleanup because of bug 2) + # + # 2) https://bugs.python.org/issue37380 + # subprocess.Popen._internal_poll on windows is getting + # + # OSError: [WinError 6] The handle is invalid + # + # exception, which it doesn't ignore and so Popen is not able to cleanup + # old processes and that prevents it from creating any new processes at + # all, which results in our tests failing whenever they try to use Popen. + + def noop(): + pass + + subprocess._cleanup = noop else: import resource