From 72c9bf8f8aef8726a5099f50cdb7aba0c2d677f2 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Mon, 20 Jan 2025 12:33:25 +0100 Subject: [PATCH] Tests: detect timeout when joining threads (#1135) It turns out that [`threading.Thread.join`](https://docs.python.org/3/library/threading.html#threading.Thread.join) does not raise an exception when the provided timeout is exceeded. This PR adjusts a unit test to accommodate that fact. --- tests/unit/mixed/io/test_direct.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/mixed/io/test_direct.py b/tests/unit/mixed/io/test_direct.py index ed4a9428..5b42976f 100644 --- a/tests/unit/mixed/io/test_direct.py +++ b/tests/unit/mixed/io/test_direct.py @@ -123,7 +123,9 @@ def acquire_release_conn( # wait for all threads to release connections back to pool for t in threads: - t.join(timeout=1) + t.join(timeout=5) + if t.is_alive(): + raise TimeoutError(f"Joining thread timed out: {t!r}") # The pool size is still 5, but all are free self.assert_pool_size(address, 0, 5, pool)