]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421) (#110442)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 5 Oct 2023 22:20:55 +0000 (15:20 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 22:20:55 +0000 (22:20 +0000)
commit6af359b088cc5cecb98add1302e2788d57a83011
tree91df28abed4eb459102c997932df251f1d9a0f57
parent1b589850774e6386d7c04fd113a0879afa21f07c
[3.12] gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421) (#110442)

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