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

Method checkout

test/pymongo_mocks.py:44–57  ·  view source on GitHub ↗
(self, handler=None)

Source from the content-addressed store, hash-verified

42
43 @contextlib.contextmanager
44 def checkout(self, handler=None):
45 client = self.client
46 host_and_port = f"{self.mock_host}:{self.mock_port}"
47 if host_and_port in client.mock_down_hosts:
48 raise AutoReconnect("mock error")
49
50 assert host_and_port in (
51 client.mock_standalones + client.mock_members + client.mock_mongoses
52 ), "bad host: %s" % host_and_port
53
54 with Pool.checkout(self, handler) as conn:
55 conn.mock_host = self.mock_host
56 conn.mock_port = self.mock_port
57 yield conn
58
59
60class DummyMonitor:

Callers

nothing calls this directly

Calls 1

AutoReconnectClass · 0.90

Tested by

no test coverage detected