1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +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.
This commit is contained in:
catborise 2026-11-08 22:12:55 +03:00
parent 59bc426665
commit e4fc2547c2

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