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

Method test_unacknowledged_writes

test/test_session.py:831–856  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

829 )
830
831 def test_unacknowledged_writes(self):
832 # Ensure the collection exists.
833 self.client.pymongo_test.test_unacked_writes.insert_one({})
834 client = self.rs_or_single_client(w=0, event_listeners=[self.listener])
835 db = client.pymongo_test
836 coll = db.test_unacked_writes
837 ops: list = [
838 (client.drop_database, [db.name], {}),
839 (db.create_collection, ["collection"], {}),
840 (db.drop_collection, ["collection"], {}),
841 ]
842 ops.extend(self.collection_write_ops(coll))
843 self._test_unacknowledged_ops(client, *ops)
844
845 def drop_db():
846 try:
847 self.client.drop_database(db.name)
848 return True
849 except OperationFailure as exc:
850 # Try again on BackgroundOperationInProgressForDatabase and
851 # BackgroundOperationInProgressForNamespace.
852 if exc.code in (12586, 12587):
853 return False
854 raise
855
856 wait_until(drop_db, "dropped database after w=0 writes")
857
858 def test_snapshot_incompatible_with_causal_consistency(self):
859 with self.client.start_session(causal_consistency=False, snapshot=False):

Callers

nothing calls this directly

Calls 5

collection_write_opsMethod · 0.95
wait_untilFunction · 0.85
rs_or_single_clientMethod · 0.80
insert_oneMethod · 0.45

Tested by

no test coverage detected