PYTHON-4643 Fix test_to_list_tailable (#1783)

This commit is contained in:
Shane Harvey 2024-08-09 23:19:15 -07:00 committed by GitHub
parent 940d2c85fb
commit 4742737876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -1380,7 +1380,6 @@ class TestCursor(AsyncIntegrationTest):
self.assertEqual("getMore", started[1].command_name)
self.assertNotIn("$readPreference", started[1].command)
@async_client_context.require_version_min(4, 0)
@async_client_context.require_replica_set
async def test_to_list_tailable(self):
oplog = self.client.local.oplog.rs
@ -1391,7 +1390,10 @@ class TestCursor(AsyncIntegrationTest):
{"ts": {"$gte": ts}}, cursor_type=pymongo.CursorType.TAILABLE_AWAIT, oplog_replay=True
).max_await_time_ms(1)
self.addAsyncCleanup(c.close)
docs = await c.to_list()
# Wait for the change to be read.
docs = []
while not docs:
docs = await c.to_list()
self.assertGreaterEqual(len(docs), 1)
async def test_to_list_empty(self):

View File

@ -1371,7 +1371,6 @@ class TestCursor(IntegrationTest):
self.assertEqual("getMore", started[1].command_name)
self.assertNotIn("$readPreference", started[1].command)
@client_context.require_version_min(4, 0)
@client_context.require_replica_set
def test_to_list_tailable(self):
oplog = self.client.local.oplog.rs
@ -1382,7 +1381,10 @@ class TestCursor(IntegrationTest):
{"ts": {"$gte": ts}}, cursor_type=pymongo.CursorType.TAILABLE_AWAIT, oplog_replay=True
).max_await_time_ms(1)
self.addCleanup(c.close)
docs = c.to_list()
# Wait for the change to be read.
docs = []
while not docs:
docs = c.to_list()
self.assertGreaterEqual(len(docs), 1)
def test_to_list_empty(self):