Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/asynchronous/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
OvertCommandListener,
async_wait_until,
)
from test.version import Version

from bson import encode
from bson.codec_options import CodecOptions
Expand Down Expand Up @@ -335,8 +336,6 @@ async def test_create_index(self):
await db.test.create_index(["hello", ("world", DESCENDING)])
await db.test.create_index({"hello": 1}.items()) # type:ignore[arg-type]

# TODO: PYTHON-5491 - remove version max
@async_client_context.require_version_max(8, 0, -1)
async def test_drop_index(self):
db = self.db
await db.test.drop_indexes()
Expand All @@ -348,7 +347,10 @@ async def test_drop_index(self):
await db.test.drop_index(name)

# Drop it again.
with self.assertRaises(OperationFailure):
if async_client_context.version < Version(8, 3, -1):
with self.assertRaises(OperationFailure):
await db.test.drop_index(name)
else:
await db.test.drop_index(name)
self.assertEqual(len(await db.test.index_information()), 2)
self.assertIn("hello_1", await db.test.index_information())
Expand Down
8 changes: 5 additions & 3 deletions test/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
OvertCommandListener,
wait_until,
)
from test.version import Version

from bson import encode
from bson.codec_options import CodecOptions
Expand Down Expand Up @@ -333,8 +334,6 @@ def test_create_index(self):
db.test.create_index(["hello", ("world", DESCENDING)])
db.test.create_index({"hello": 1}.items()) # type:ignore[arg-type]

# TODO: PYTHON-5491 - remove version max
@client_context.require_version_max(8, 0, -1)
def test_drop_index(self):
db = self.db
db.test.drop_indexes()
Expand All @@ -346,7 +345,10 @@ def test_drop_index(self):
db.test.drop_index(name)

# Drop it again.
with self.assertRaises(OperationFailure):
if client_context.version < Version(8, 3, -1):
with self.assertRaises(OperationFailure):
db.test.drop_index(name)
else:
db.test.drop_index(name)
self.assertEqual(len(db.test.index_information()), 2)
self.assertIn("hello_1", db.test.index_information())
Expand Down
Loading