diff --git a/test/asynchronous/test_collection.py b/test/asynchronous/test_collection.py index 90a0518532..379ec9e8c8 100644 --- a/test/asynchronous/test_collection.py +++ b/test/asynchronous/test_collection.py @@ -40,6 +40,7 @@ OvertCommandListener, async_wait_until, ) +from test.version import Version from bson import encode from bson.codec_options import CodecOptions @@ -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() @@ -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()) diff --git a/test/test_collection.py b/test/test_collection.py index b1947259ba..1bd3a80c5f 100644 --- a/test/test_collection.py +++ b/test/test_collection.py @@ -40,6 +40,7 @@ OvertCommandListener, wait_until, ) +from test.version import Version from bson import encode from bson.codec_options import CodecOptions @@ -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() @@ -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())