From 9e21e2e86bee5b0de42fe28153dd1bcb0aa51d27 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 10 Aug 2023 13:23:33 +0200 Subject: tests: Handle PermissionError for waitpid in test_restart While not documented that way: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait?view=msvc-170 It looks like that Windows sometimes sets errno to EACCES here (causing a PermissionError): > os.waitpid(pid, 0) # pid, options... positional-only :( E PermissionError: [Errno 13] Permission denied I have no idea why it happens, but it results in flaky tests on CI. We aren't particularly interested in this (we just want to make sure the process is cleaned up before the next test runs...), so let's just ignore this. --- tests/end2end/test_invocations.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index e31aa3ecb..af81781f6 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -937,6 +937,7 @@ def test_restart(request, quteproc_new): # If the new process hangs, this will hang too. # Still better than just ignoring it, so we can fix it if something is broken. os.waitpid(pid, 0) # pid, options... positional-only :( - except ChildProcessError: - # Already gone + except (ChildProcessError, PermissionError): + # Already gone. Even if not documented, Windows seems to raise PermissionError + # here... pass -- cgit v1.2.3-54-g00ecf