1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 22:12:55 +03:00
parent f09a1b67f5
commit 0d225edda4

View file

@ -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