No subject


Sun Aug 14 03:43:08 PDT 2016


and when I do this, my tests pass as expected, but Tox stops with a
KeyboardInterrupt exception as soon as the py.test command is over, which
causes my test suite to fail.

Seems like this function behaves differently from os.kill() in that it
sends the CTRL-C event to the entire process group rather than only a
single process.  Since Tox is the root of the process group in which
py.test runs, it also receives the CTRL-C event.

[1]: https://msdn.microsoft.com/library/ms683155.aspx

Seems that, to get the behavior I expect, I need to have Tox run its
commands using the "CREATE_NEW_PROCESS_GROUP" flag.

Any chance you'd be willing to accept a PR that enables this?

Thanks,

Andr=C3=A9

--047d7beb996a2c918d053a10927f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi all,<div><br></div><div>I&#39;m writing a context manag=
er for asyncio that will set the result on a future when CTRL-C or SIGINT i=
s received and I have an issue with the Windows part.</div><div><br></div><=
div>When testing on POSIX platforms, I use &quot;os.kill(os.getpid(), signa=
l.SIGINT)&quot; to execute my signal handler.=C2=A0 I&#39;m trying to conve=
rt this to some Windows equivalent an I&#39;m getting a surprise.</div><div=
><br></div><div>From my understanding, I need to call SetConsoleCtrlHandler=
[1] via ctypes and when I do this, my tests pass as expected, but Tox stops=
 with a KeyboardInterrupt exception as soon as the py.test command is over,=
 which causes my test suite to fail.</div><div><br></div><div>Seems like th=
is function behaves differently from os.kill() in that it sends the CTRL-C =
event to the entire process group rather than only a single process.=C2=A0 =
Since Tox is the root of the process group in which py.test runs, it also r=
eceives the CTRL-C event.</div><div><br></div><div>[1]:=C2=A0<a href=3D"htt=
ps://msdn.microsoft.com/library/ms683155.aspx">https://msdn.microsoft.com/l=
ibrary/ms683155.aspx</a><br></div><div><br></div><div>Seems that, to get th=
e behavior I expect, I need to have Tox run its commands using the &quot;CR=
EATE_NEW_PROCESS_GROUP&quot; flag.</div><div><br></div><div>Any chance you&=
#39;d be willing to accept a PR that enables this?</div><div><br></div><div=
>Thanks,</div><div><br></div><div>Andr=C3=A9</div></div>

--047d7beb996a2c918d053a10927f--



More information about the testing-in-python mailing list