Skip to content

Commit

Permalink
PYTHON-5005 Skip more csot tests where applicable (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Dec 4, 2024
1 parent 11287e1 commit dc34833
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/asynchronous/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import copy
import gc
import itertools
import os
import random
import re
import sys
Expand Down Expand Up @@ -1412,6 +1413,8 @@ async def test_to_list_length(self):
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
Expand Down Expand Up @@ -1453,6 +1456,8 @@ async def test_command_cursor_to_list_length(self):

@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
Expand Down
4 changes: 4 additions & 0 deletions test/test_csot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -76,6 +78,8 @@ def test_timeout_nested(self):

@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:
Expand Down
5 changes: 5 additions & 0 deletions test/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import copy
import gc
import itertools
import os
import random
import re
import sys
Expand Down Expand Up @@ -1403,6 +1404,8 @@ def test_to_list_length(self):
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
Expand Down Expand Up @@ -1444,6 +1447,8 @@ def test_command_cursor_to_list_length(self):

@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
Expand Down

0 comments on commit dc34833

Please sign in to comment.