From e4fc2547c2b694078186e50f3cf4b83af5cee6a4 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 8 Nov 2026 22:12:55 +0300 Subject: [PATCH] test(connection): a test waits for the opens it started BoundedOpenTestCase released its blocked opens when a test ended but did not wait for them: an open that ended during the next test logged "h: connected" into that test's assertLogs, and the log test failed in two of three runs of the vrtManager tests in reverse order. The cleanup now joins the threads the test started. --- vrtManager/tests/test_connection.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vrtManager/tests/test_connection.py b/vrtManager/tests/test_connection.py index c62bcf72..76163b63 100644 --- a/vrtManager/tests/test_connection.py +++ b/vrtManager/tests/test_connection.py @@ -57,9 +57,16 @@ class BoundedOpenTestCase(unittest.TestCase): self.addCleanup(patcher.stop) self.manager = wvmConnectionManager() self.release = threading.Event() - self.addCleanup(self.release.set) + self.threads = set(threading.enumerate()) + self.addCleanup(self.finish_opens) self.calls = 0 + def finish_opens(self): + """Let every open this test started end: one ending later would log into another test.""" + self.release.set() + for thread in set(threading.enumerate()) - self.threads: + thread.join(5) + def open_auth(self, result): def open_auth(uri, auth, flags): self.calls += 1