(self, handler=None)
| 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 | |
| 60 | class DummyMonitor: |
nothing calls this directly
no test coverage detected