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

Method require_connection

test/__init__.py:485–491  ·  view source on GitHub ↗

Run a test only if we can connect to MongoDB.

(self, func: Any)

Source from the content-addressed store, hash-verified

483 self.client[dbname].command("dropUser", user, writeConcern={"w": self.w})
484
485 def require_connection(self, func: Any) -> Any:
486 """Run a test only if we can connect to MongoDB."""
487 return self._require(
488 lambda: True, # _require checks if we're connected
489 "Cannot connect to MongoDB on self.pair",
490 func=func,
491 )
492
493 def require_version_min(self, *ver):
494 """Run a test only if the server version is at least ``version``."""

Callers

nothing calls this directly

Calls 1

_requireMethod · 0.95

Tested by

no test coverage detected