Skip to content
Browse files

More reliable multithread tests on slow machines

  • Loading branch information...
1 parent 6b056ee commit 326b710382413181bd80e6062539a89b4d30ff67 @ajdavis ajdavis committed
Showing with 9 additions and 4 deletions.
  1. +2 −2 test/test_pooling.py
  2. +7 −2 test/test_threads.py
View
4 test/test_pooling.py
@@ -86,8 +86,8 @@ def run_in_request():
# Join thread
acquired = False
- for i in range(10):
- time.sleep(0.1)
+ for i in range(30):
+ time.sleep(0.5)
acquired = lock.acquire(0)
if acquired:
break
View
9 test/test_threads.py
@@ -355,7 +355,7 @@ def test_server_disconnect(self):
t.start()
# Wait for the threads to reach the rendezvous
- state.ev_arrived.wait(1)
+ state.ev_arrived.wait(10)
self.assertTrue(state.ev_arrived.isSet(), "Thread timeout")
try:
@@ -365,6 +365,11 @@ def test_server_disconnect(self):
for t in threads:
t.request_sock.close()
+ # Finally, ensure the main thread's socket's last_checkout is
+ # updated:
+ collection.find_one()
+
+ # ... and close it:
request_sock.close()
# Doing an operation on the connection raises an AutoReconnect and
@@ -376,7 +381,7 @@ def test_server_disconnect(self):
state.ev_resume.set()
for t in threads:
- t.join(1)
+ t.join(10)
self.assertFalse(t.isAlive(), "Thread timeout")
for t in threads:

0 comments on commit 326b710

Please sign in to comment.
Something went wrong with that request. Please try again.