Skip to content

Commit

Permalink
Tests: detect timeout when joining threads (#1135)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robsdedude authored Jan 20, 2025
1 parent cb01e6e commit 72c9bf8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/unit/mixed/io/test_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 72c9bf8

Please sign in to comment.