MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_wait_queue_timeout

Method test_wait_queue_timeout

test/test_pooling.py:322–338  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

320 pass
321
322 def test_wait_queue_timeout(self):
323 wait_queue_timeout = 2 # Seconds
324 pool = self.create_pool(max_pool_size=1, wait_queue_timeout=wait_queue_timeout)
325 self.addCleanup(pool.close)
326
327 with pool.checkout():
328 start = time.time()
329 with self.assertRaises(ConnectionFailure):
330 with pool.checkout():
331 pass
332
333 duration = time.time() - start
334 self.assertLess(
335 abs(wait_queue_timeout - duration),
336 1,
337 f"Waited {duration:.2f} seconds for a socket, expected {wait_queue_timeout:f}",
338 )
339
340 def test_no_wait_queue_timeout(self):
341 # Verify get_socket() with no wait_queue_timeout blocks forever.

Callers

nothing calls this directly

Calls 4

addCleanupMethod · 0.80
timeMethod · 0.80
create_poolMethod · 0.45
checkoutMethod · 0.45

Tested by

no test coverage detected