From 11287e12570efeb86f4fb927d3170fa8e2cc59df Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 4 Dec 2024 09:18:13 -0600 Subject: [PATCH 1/2] PYTHON-5004 Fix handling of TEST_PATH (#2028) --- test/asynchronous/unified_format.py | 1 + test/unified_format.py | 1 + 2 files changed, 2 insertions(+) diff --git a/test/asynchronous/unified_format.py b/test/asynchronous/unified_format.py index b18b09383..52d964eb3 100644 --- a/test/asynchronous/unified_format.py +++ b/test/asynchronous/unified_format.py @@ -442,6 +442,7 @@ class UnifiedSpecTestMixinV1(AsyncIntegrationTest): RUN_ON_LOAD_BALANCER = True RUN_ON_SERVERLESS = True TEST_SPEC: Any + TEST_PATH = "" # This gets filled in by generate_test_classes mongos_clients: list[AsyncMongoClient] = [] @staticmethod diff --git a/test/unified_format.py b/test/unified_format.py index 5cb268a29..372eb8abb 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -441,6 +441,7 @@ class UnifiedSpecTestMixinV1(IntegrationTest): RUN_ON_LOAD_BALANCER = True RUN_ON_SERVERLESS = True TEST_SPEC: Any + TEST_PATH = "" # This gets filled in by generate_test_classes mongos_clients: list[MongoClient] = [] @staticmethod From dc34833d97d1a97ac38fc03117a84ad5f87220c6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 4 Dec 2024 09:26:29 -0600 Subject: [PATCH 2/2] PYTHON-5005 Skip more csot tests where applicable (#2029) --- test/asynchronous/test_cursor.py | 5 +++++ test/test_csot.py | 4 ++++ test/test_cursor.py | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/test/asynchronous/test_cursor.py b/test/asynchronous/test_cursor.py index d21647945..d843ffb4a 100644 --- a/test/asynchronous/test_cursor.py +++ b/test/asynchronous/test_cursor.py @@ -18,6 +18,7 @@ from __future__ import annotations import copy import gc import itertools +import os import random import re import sys @@ -1412,6 +1413,8 @@ class TestCursor(AsyncIntegrationTest): self.assertEqual(len(docs), 2) async def test_to_list_csot_applied(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") client = await self.async_single_client(timeoutMS=500, w=1) coll = client.pymongo.test # Initialize the client with a larger timeout to help make test less flakey @@ -1453,6 +1456,8 @@ class TestCursor(AsyncIntegrationTest): @async_client_context.require_failCommand_blockConnection async def test_command_cursor_to_list_csot_applied(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") client = await self.async_single_client(timeoutMS=500, w=1) coll = client.pymongo.test # Initialize the client with a larger timeout to help make test less flakey diff --git a/test/test_csot.py b/test/test_csot.py index 64210b4d6..c075a07d5 100644 --- a/test/test_csot.py +++ b/test/test_csot.py @@ -39,6 +39,8 @@ class TestCSOT(IntegrationTest): RUN_ON_LOAD_BALANCER = True def test_timeout_nested(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") coll = self.db.coll self.assertEqual(_csot.get_timeout(), None) self.assertEqual(_csot.get_deadline(), float("inf")) @@ -76,6 +78,8 @@ class TestCSOT(IntegrationTest): @client_context.require_change_streams def test_change_stream_can_resume_after_timeouts(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") coll = self.db.test coll.insert_one({}) with coll.watch() as stream: diff --git a/test/test_cursor.py b/test/test_cursor.py index bcc7ed75f..84e431f8c 100644 --- a/test/test_cursor.py +++ b/test/test_cursor.py @@ -18,6 +18,7 @@ from __future__ import annotations import copy import gc import itertools +import os import random import re import sys @@ -1403,6 +1404,8 @@ class TestCursor(IntegrationTest): self.assertEqual(len(docs), 2) def test_to_list_csot_applied(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") client = self.single_client(timeoutMS=500, w=1) coll = client.pymongo.test # Initialize the client with a larger timeout to help make test less flakey @@ -1444,6 +1447,8 @@ class TestCursor(IntegrationTest): @client_context.require_failCommand_blockConnection def test_command_cursor_to_list_csot_applied(self): + if os.environ.get("SKIP_CSOT_TESTS", ""): + raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...") client = self.single_client(timeoutMS=500, w=1) coll = client.pymongo.test # Initialize the client with a larger timeout to help make test less flakey