]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421) (#110443)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 5 Oct 2023 22:06:28 +0000 (15:06 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 22:06:28 +0000 (22:06 +0000)
commit67129c379cdfc7e880bc1cfdef3df1f562c94853
treed3d8bda1cd87546c2658c05761741814d42efd2d
parent4134036ce9673b76cc8e6236361a77098ee72ad1
[3.11] gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421) (#110443)

gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421)

Replace os.kill() with proc.kill() which catchs PermissionError.

Rewrite _kill_with_event():

* Use subprocess context manager ("with proc:").
* Use sleeping_retry() to wait until the child process is ready.
* Replace SIGINT with proc.kill() on error.
* Replace 10 seconds with SHORT_TIMEOUT to wait until the process is
  ready.
* Replace 0.5 seconds with SHORT_TIMEOUT to wait for the process
  exit.
(cherry picked from commit aaf297c048694cd9652790f8b74e69f7ddadfbde)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_os.py