From e87af9ca62fc26341268a30e1df78c1b02937d3e Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Tue, 5 May 2026 10:24:28 -0400 Subject: [PATCH 1/2] PYTHON-5813 - Skip QE prefixPreview and suffixPreview tests on server 9.0.0+ --- test/asynchronous/test_encryption.py | 5 +++++ .../unified/QE-Text-cleanupStructuredEncryptionData.json | 1 + .../unified/QE-Text-compactStructuredEncryptionData.json | 1 + .../spec/unified/QE-Text-prefixPreview.json | 1 + .../spec/unified/QE-Text-substringPreview.json | 2 +- .../spec/unified/QE-Text-suffixPreview.json | 1 + test/test_encryption.py | 5 +++++ 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 9650f7043f..4bba6aa76f 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -3408,6 +3408,7 @@ async def asyncSetUp(self): ) await coll.insert_one({"_id": 0, "encryptedText": encrypted_value}) + @async_client_context.require_version_max(8, 99, 99) async def test_01_can_find_a_document_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts. text_opts = TextOpts( @@ -3432,6 +3433,7 @@ async def test_01_can_find_a_document_by_prefix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) + @async_client_context.require_version_max(8, 99, 99) async def test_02_can_find_a_document_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3456,6 +3458,7 @@ async def test_02_can_find_a_document_by_suffix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) + @async_client_context.require_version_max(8, 99, 99) async def test_03_no_document_found_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3478,6 +3481,7 @@ async def test_03_no_document_found_by_prefix(self): # Assert that no documents are returned. self.assertIsNone(value) + @async_client_context.require_version_max(8, 99, 99) async def test_04_no_document_found_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: text_opts = TextOpts( @@ -3554,6 +3558,7 @@ async def test_06_no_document_found_by_substring(self): # Assert that no documents are returned. self.assertIsNone(value) + @async_client_context.require_version_max(8, 99, 99) async def test_07_contentionFactor_is_required(self): from pymongocrypt.errors import MongoCryptError diff --git a/test/client-side-encryption/spec/unified/QE-Text-cleanupStructuredEncryptionData.json b/test/client-side-encryption/spec/unified/QE-Text-cleanupStructuredEncryptionData.json index 24f33ab3ec..fd74573ea2 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-cleanupStructuredEncryptionData.json +++ b/test/client-side-encryption/spec/unified/QE-Text-cleanupStructuredEncryptionData.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/client-side-encryption/spec/unified/QE-Text-compactStructuredEncryptionData.json b/test/client-side-encryption/spec/unified/QE-Text-compactStructuredEncryptionData.json index c7abfe2d4b..a89ab96fc4 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-compactStructuredEncryptionData.json +++ b/test/client-side-encryption/spec/unified/QE-Text-compactStructuredEncryptionData.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json b/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json index 7279385743..c193608e88 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json +++ b/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json index 6a8f133eac..7787194fc6 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json +++ b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json @@ -126,7 +126,7 @@ ], "tests": [ { - "description": "Insert QE suffixPreview", + "description": "Insert QE substringPreview", "operations": [ { "name": "insertOne", diff --git a/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json b/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json index deec5e63b0..2de5cde4a4 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json +++ b/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/test_encryption.py b/test/test_encryption.py index af9f2e3df7..27ef9c00db 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -3390,6 +3390,7 @@ def setUp(self): ) coll.insert_one({"_id": 0, "encryptedText": encrypted_value}) + @client_context.require_version_max(8, 99, 99) def test_01_can_find_a_document_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts. text_opts = TextOpts( @@ -3414,6 +3415,7 @@ def test_01_can_find_a_document_by_prefix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) + @client_context.require_version_max(8, 99, 99) def test_02_can_find_a_document_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3438,6 +3440,7 @@ def test_02_can_find_a_document_by_suffix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) + @client_context.require_version_max(8, 99, 99) def test_03_no_document_found_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3460,6 +3463,7 @@ def test_03_no_document_found_by_prefix(self): # Assert that no documents are returned. self.assertIsNone(value) + @client_context.require_version_max(8, 99, 99) def test_04_no_document_found_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: text_opts = TextOpts( @@ -3536,6 +3540,7 @@ def test_06_no_document_found_by_substring(self): # Assert that no documents are returned. self.assertIsNone(value) + @client_context.require_version_max(8, 99, 99) def test_07_contentionFactor_is_required(self): from pymongocrypt.errors import MongoCryptError From 5e76adf07a30662385bcd61dd39f7e593a9451e5 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Tue, 5 May 2026 10:41:47 -0400 Subject: [PATCH 2/2] Better skipping --- test/asynchronous/test_encryption.py | 6 +----- test/test_encryption.py | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 4bba6aa76f..1503f54c76 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -3326,6 +3326,7 @@ async def test_collection_name_collision(self): class TestExplicitTextEncryptionProse(AsyncEncryptionIntegrationTest): @async_client_context.require_no_standalone @async_client_context.require_version_min(8, 2, -1) + @async_client_context.require_version_max(8, 99, 99) @async_client_context.require_libmongocrypt_min(1, 15, 1) @async_client_context.require_pymongocrypt_min(1, 16, 0) async def asyncSetUp(self): @@ -3408,7 +3409,6 @@ async def asyncSetUp(self): ) await coll.insert_one({"_id": 0, "encryptedText": encrypted_value}) - @async_client_context.require_version_max(8, 99, 99) async def test_01_can_find_a_document_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts. text_opts = TextOpts( @@ -3433,7 +3433,6 @@ async def test_01_can_find_a_document_by_prefix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) - @async_client_context.require_version_max(8, 99, 99) async def test_02_can_find_a_document_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3458,7 +3457,6 @@ async def test_02_can_find_a_document_by_suffix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) - @async_client_context.require_version_max(8, 99, 99) async def test_03_no_document_found_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3481,7 +3479,6 @@ async def test_03_no_document_found_by_prefix(self): # Assert that no documents are returned. self.assertIsNone(value) - @async_client_context.require_version_max(8, 99, 99) async def test_04_no_document_found_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: text_opts = TextOpts( @@ -3558,7 +3555,6 @@ async def test_06_no_document_found_by_substring(self): # Assert that no documents are returned. self.assertIsNone(value) - @async_client_context.require_version_max(8, 99, 99) async def test_07_contentionFactor_is_required(self): from pymongocrypt.errors import MongoCryptError diff --git a/test/test_encryption.py b/test/test_encryption.py index 27ef9c00db..0993362273 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -3308,6 +3308,7 @@ def test_collection_name_collision(self): class TestExplicitTextEncryptionProse(EncryptionIntegrationTest): @client_context.require_no_standalone @client_context.require_version_min(8, 2, -1) + @client_context.require_version_max(8, 99, 99) @client_context.require_libmongocrypt_min(1, 15, 1) @client_context.require_pymongocrypt_min(1, 16, 0) def setUp(self): @@ -3390,7 +3391,6 @@ def setUp(self): ) coll.insert_one({"_id": 0, "encryptedText": encrypted_value}) - @client_context.require_version_max(8, 99, 99) def test_01_can_find_a_document_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts. text_opts = TextOpts( @@ -3415,7 +3415,6 @@ def test_01_can_find_a_document_by_prefix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) - @client_context.require_version_max(8, 99, 99) def test_02_can_find_a_document_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3440,7 +3439,6 @@ def test_02_can_find_a_document_by_suffix(self): value.pop("__safeContent__", None) self.assertEqual(value, expected) - @client_context.require_version_max(8, 99, 99) def test_03_no_document_found_by_prefix(self): # Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: text_opts = TextOpts( @@ -3463,7 +3461,6 @@ def test_03_no_document_found_by_prefix(self): # Assert that no documents are returned. self.assertIsNone(value) - @client_context.require_version_max(8, 99, 99) def test_04_no_document_found_by_suffix(self): # Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: text_opts = TextOpts( @@ -3540,7 +3537,6 @@ def test_06_no_document_found_by_substring(self): # Assert that no documents are returned. self.assertIsNone(value) - @client_context.require_version_max(8, 99, 99) def test_07_contentionFactor_is_required(self): from pymongocrypt.errors import MongoCryptError