1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 08:56:07 +00:00

test(connection): the thread tests wait for the opens they started

ConnectionThreadsTestCase, like BoundedOpenTestCase, released its blocked
opens when a test ended without waiting for them, so an open could still
end during the next test. Its cleanup joins the threads the test started.
This commit is contained in:
catborise 2026-11-08 22:38:07 +03:00
parent 1056f40ff6
commit 04f39d469c

View file

@ -24,9 +24,16 @@ class ConnectionThreadsTestCase(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.opened = []
def finish_opens(self):
"""Let every open this test started end: one ending later would run into another test."""
self.release.set()
for thread in set(threading.enumerate()) - self.threads:
thread.join(5)
def open_auth(self, *conns):
pending = list(conns)