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

Method test_pool_reuses_open_socket

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

Source from the content-addressed store, hash-verified

189 run_cases(self.c, [NonUnique, Unique, InsertOneAndFind])
190
191 def test_pool_reuses_open_socket(self):
192 # Test Pool's _check_closed() method doesn't close a healthy socket.
193 cx_pool = self.create_pool(max_pool_size=10)
194 cx_pool._check_interval_seconds = 0 # Always check.
195 with cx_pool.checkout() as conn:
196 pass
197
198 with cx_pool.checkout() as new_connection:
199 self.assertEqual(conn, new_connection)
200
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.

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.45
checkoutMethod · 0.45

Tested by

no test coverage detected