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

Method require_secondaries_count

test/__init__.py:559–570  ·  view source on GitHub ↗

Run a test only if the client is connected to a replica set that has `count` secondaries.

(self, count)

Source from the content-addressed store, hash-verified

557 return self._require(lambda: self.is_rs, "Not connected to a replica set", func=func)
558
559 def require_secondaries_count(self, count):
560 """Run a test only if the client is connected to a replica set that has
561 `count` secondaries.
562 """
563
564 def sec_count():
565 return 0 if not self.client else len(self.client.secondaries)
566
567 def check():
568 return sec_count() >= count
569
570 return self._require(check, "Not enough secondaries available")
571
572 @property
573 def supports_secondary_read_pref(self):

Callers

nothing calls this directly

Calls 1

_requireMethod · 0.95

Tested by

no test coverage detected