]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-109888: Fix test_os _kill_with_event() on Windows (#110421)
authorVictor Stinner <vstinner@python.org>
Thu, 5 Oct 2023 21:40:49 +0000 (23:40 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 21:40:49 +0000 (21:40 +0000)
commitaaf297c048694cd9652790f8b74e69f7ddadfbde
treef42eb8c344c7080fdac985389e97357723d2c76d
parentfb6c4ed2bbb2a867d5f0b9a94656e4714be5d9c2
gh-109888: Fix test_os _kill_with_event() on Windows (#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.
Lib/test/test_os.py