Skip to content

Commit 72c9bf8

Browse files
authored
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.
1 parent cb01e6e commit 72c9bf8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/unit/mixed/io/test_direct.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def acquire_release_conn(
123123

124124
# wait for all threads to release connections back to pool
125125
for t in threads:
126-
t.join(timeout=1)
126+
t.join(timeout=5)
127+
if t.is_alive():
128+
raise TimeoutError(f"Joining thread timed out: {t!r}")
127129
# The pool size is still 5, but all are free
128130
self.assert_pool_size(address, 0, 5, pool)
129131

0 commit comments

Comments
 (0)