Skip to content

Commit 2a96ae2

Browse files
committed
more robust test
1 parent 8a0823d commit 2a96ae2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_session.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ def test_session_multiple_threads():
5656
threads.append(t)
5757
t.start()
5858

59-
for t in threads:
60-
t.join(1)
61-
assert not t.is_alive()
59+
loopcount = 0
60+
max_loops = len(threads) * 2
61+
while len(threads):
62+
threads[0].join(1)
63+
if not threads[0].is_alive():
64+
threads.pop(0)
65+
loopcount += 1
66+
if loopcount > max_loops:
67+
pytest.fail("Threads did not complete")
6268

6369
assert len(clients) == num_tasks
6470
assert len({id(s) for s in clients}) == 10

0 commit comments

Comments
 (0)