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

Method test_get_socket_and_exception

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

Source from the content-addressed store, hash-verified

201 self.assertEqual(1, len(cx_pool.conns))
202
203 def test_get_socket_and_exception(self):
204 # get_socket() returns socket after a non-network error.
205 cx_pool = self.create_pool(max_pool_size=1, wait_queue_timeout=1)
206 with self.assertRaises(ZeroDivisionError):
207 with cx_pool.checkout() as conn:
208 1 / 0
209
210 # Socket was returned, not closed.
211 with cx_pool.checkout() as new_connection:
212 self.assertEqual(conn, new_connection)
213
214 self.assertEqual(1, len(cx_pool.conns))
215
216 def test_pool_removes_closed_socket(self):
217 # Test that Pool removes explicitly closed socket.

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.45
checkoutMethod · 0.45

Tested by

no test coverage detected