Skip to content

Commit 1053931

Browse files
authored
PYTHON-4533 - Fix failing async tests (#1739)
1 parent 0d89e12 commit 1053931

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

test/asynchronous/test_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async def test_add_remove_option_exhaust(self):
129129
# Exhaust - which mongos doesn't support
130130
if async_client_context.is_mongos:
131131
with self.assertRaises(InvalidOperation):
132-
self.db.test.find(cursor_type=CursorType.EXHAUST)
132+
await anext(self.db.test.find(cursor_type=CursorType.EXHAUST))
133133
else:
134134
cursor = self.db.test.find(cursor_type=CursorType.EXHAUST)
135135
self.assertEqual(64, cursor._query_flags)

test/asynchronous/test_transactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async def test_unpin_for_next_transaction(self):
192192
addresses = set()
193193
for _ in range(UNPIN_TEST_MAX_ATTEMPTS):
194194
async with await s.start_transaction():
195-
cursor = await coll.find({}, session=s)
195+
cursor = coll.find({}, session=s)
196196
self.assertTrue(await anext(cursor))
197197
addresses.add(cursor.address)
198198
# Break early if we can.
@@ -219,7 +219,7 @@ async def test_unpin_for_non_transaction_operation(self):
219219

220220
addresses = set()
221221
for _ in range(UNPIN_TEST_MAX_ATTEMPTS):
222-
cursor = await coll.find({}, session=s)
222+
cursor = coll.find({}, session=s)
223223
self.assertTrue(await anext(cursor))
224224
addresses.add(cursor.address)
225225
# Break early if we can.

test/test_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_add_remove_option_exhaust(self):
129129
# Exhaust - which mongos doesn't support
130130
if client_context.is_mongos:
131131
with self.assertRaises(InvalidOperation):
132-
self.db.test.find(cursor_type=CursorType.EXHAUST)
132+
next(self.db.test.find(cursor_type=CursorType.EXHAUST))
133133
else:
134134
cursor = self.db.test.find(cursor_type=CursorType.EXHAUST)
135135
self.assertEqual(64, cursor._query_flags)

0 commit comments

Comments
 (0)