From b8fcbab7d12c726ded9d6c093f61d1f01603dd50 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 26 Aug 2026 14:51:55 -0400 Subject: [PATCH] PYTHON-6055 - Mark maxConnecting unified CMAP tests as flaky --- .../test_connection_monitoring.py | 19 ++++++++++++++++++- test/test_connection_monitoring.py | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_connection_monitoring.py b/test/asynchronous/test_connection_monitoring.py index d3bb6ad29e..fda78fb560 100644 --- a/test/asynchronous/test_connection_monitoring.py +++ b/test/asynchronous/test_connection_monitoring.py @@ -18,11 +18,12 @@ import asyncio import os +import re import sys import time from pathlib import Path -from test.asynchronous.utils import async_get_pool, async_get_pools +from test.asynchronous.utils import async_get_pool, async_get_pools, flaky sys.path[0:0] = [""] @@ -216,6 +217,22 @@ async def set_fail_point(self, command_args): await self.configure_fail_point(self.client, command_args) async def run_scenario(self, scenario_def, test): + # Handle flaky tests. + flaky_tests = [ + ("PYTHON-6055", ".*pool_checkout_custom_maxConnecting_is_enforced.*"), + ("PYTHON-6055", ".*pool_checkout_maxConnecting_is_enforced.*"), + ("PYTHON-6055", ".*pool_checkout_maxConnecting_timeout.*"), + ("PYTHON-6055", ".*pool_checkout_minPoolSize_connection_maxConnecting.*"), + ("PYTHON-6055", ".*pool_checkout_returned_connection_maxConnecting.*"), + ] + for reason, flaky_test in flaky_tests: + if re.match(flaky_test.lower(), self.id().lower()) is not None: + decorator = flaky(reason=reason, func_name=self.id(), affects_cpython_linux=True) + await decorator(self._run_scenario)(scenario_def, test) + return + await self._run_scenario(scenario_def, test) + + async def _run_scenario(self, scenario_def, test): """Run a CMAP spec test.""" self.logs: list = [] self.assertEqual(scenario_def["version"], 1) diff --git a/test/test_connection_monitoring.py b/test/test_connection_monitoring.py index e67d8d75fa..bca173cc4d 100644 --- a/test/test_connection_monitoring.py +++ b/test/test_connection_monitoring.py @@ -18,11 +18,12 @@ import asyncio import os +import re import sys import time from pathlib import Path -from test.utils import get_pool, get_pools +from test.utils import flaky, get_pool, get_pools sys.path[0:0] = [""] @@ -216,6 +217,22 @@ def set_fail_point(self, command_args): self.configure_fail_point(self.client, command_args) def run_scenario(self, scenario_def, test): + # Handle flaky tests. + flaky_tests = [ + ("PYTHON-6055", ".*pool_checkout_custom_maxConnecting_is_enforced.*"), + ("PYTHON-6055", ".*pool_checkout_maxConnecting_is_enforced.*"), + ("PYTHON-6055", ".*pool_checkout_maxConnecting_timeout.*"), + ("PYTHON-6055", ".*pool_checkout_minPoolSize_connection_maxConnecting.*"), + ("PYTHON-6055", ".*pool_checkout_returned_connection_maxConnecting.*"), + ] + for reason, flaky_test in flaky_tests: + if re.match(flaky_test.lower(), self.id().lower()) is not None: + decorator = flaky(reason=reason, func_name=self.id(), affects_cpython_linux=True) + decorator(self._run_scenario)(scenario_def, test) + return + self._run_scenario(scenario_def, test) + + def _run_scenario(self, scenario_def, test): """Run a CMAP spec test.""" self.logs: list = [] self.assertEqual(scenario_def["version"], 1)