From cf414ab544c365f3557e233e4ebebfd492f6c822 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 29 Jul 2026 16:18:19 -0400 Subject: [PATCH 1/3] PYTHON-5974 Loosen baseBackoffMS prose test timing --- test/asynchronous/test_client_backpressure.py | 5 +++-- test/test_client_backpressure.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/asynchronous/test_client_backpressure.py b/test/asynchronous/test_client_backpressure.py index b0cfb54b1e..eecb427c73 100644 --- a/test/asynchronous/test_client_backpressure.py +++ b/test/asynchronous/test_client_backpressure.py @@ -354,8 +354,9 @@ async def test_05_overload_errors_with_basebackoffms_override_backoff(self, rand # A run can never be faster than the sum of its backoffs. # With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. - self.assertGreaterEqual(exponential_backoff_time, 0.6) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.3) + # Allow for slight timing slack due to asyncio timing resolution on Windows <= Python 3.12 + self.assertGreaterEqual(exponential_backoff_time, 0.55) + self.assertGreaterEqual(with_base_backoff_ms_time, 0.25) self.assertLess(with_base_backoff_ms_time, 0.6) diff --git a/test/test_client_backpressure.py b/test/test_client_backpressure.py index fe510a93fb..20c7ffd093 100644 --- a/test/test_client_backpressure.py +++ b/test/test_client_backpressure.py @@ -352,8 +352,9 @@ def test_05_overload_errors_with_basebackoffms_override_backoff(self, random_fun # A run can never be faster than the sum of its backoffs. # With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. - self.assertGreaterEqual(exponential_backoff_time, 0.6) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.3) + # Allow for slight timing slack due to asyncio timing resolution on Windows <= Python 3.12 + self.assertGreaterEqual(exponential_backoff_time, 0.55) + self.assertGreaterEqual(with_base_backoff_ms_time, 0.25) self.assertLess(with_base_backoff_ms_time, 0.6) From 3afc4a57c50dbb0929198873fe228d949c587b9c Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Mon, 3 Aug 2026 09:27:06 -0400 Subject: [PATCH 2/3] SS review --- test/asynchronous/test_client_backpressure.py | 13 ++++++++++--- test/test_client_backpressure.py | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/test/asynchronous/test_client_backpressure.py b/test/asynchronous/test_client_backpressure.py index eecb427c73..5149b9e3e1 100644 --- a/test/asynchronous/test_client_backpressure.py +++ b/test/asynchronous/test_client_backpressure.py @@ -354,9 +354,16 @@ async def test_05_overload_errors_with_basebackoffms_override_backoff(self, rand # A run can never be faster than the sum of its backoffs. # With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. - # Allow for slight timing slack due to asyncio timing resolution on Windows <= Python 3.12 - self.assertGreaterEqual(exponential_backoff_time, 0.55) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.25) + + # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution + if sys.platform == "win32" and not _IS_SYNC: + exponential_expected = 0.55 + base_backoff_expected = 0.25 + else: + exponential_expected = 0.6 + base_backoff_expected = 0.3 + self.assertGreaterEqual(exponential_backoff_time, exponential_expected) + self.assertGreaterEqual(with_base_backoff_ms_time, base_backoff_expected) self.assertLess(with_base_backoff_ms_time, 0.6) diff --git a/test/test_client_backpressure.py b/test/test_client_backpressure.py index 20c7ffd093..f37d9eea71 100644 --- a/test/test_client_backpressure.py +++ b/test/test_client_backpressure.py @@ -352,9 +352,16 @@ def test_05_overload_errors_with_basebackoffms_override_backoff(self, random_fun # A run can never be faster than the sum of its backoffs. # With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. - # Allow for slight timing slack due to asyncio timing resolution on Windows <= Python 3.12 - self.assertGreaterEqual(exponential_backoff_time, 0.55) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.25) + + # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution + if sys.platform == "win32" and not _IS_SYNC: + exponential_expected = 0.55 + base_backoff_expected = 0.25 + else: + exponential_expected = 0.6 + base_backoff_expected = 0.3 + self.assertGreaterEqual(exponential_backoff_time, exponential_expected) + self.assertGreaterEqual(with_base_backoff_ms_time, base_backoff_expected) self.assertLess(with_base_backoff_ms_time, 0.6) From 23e24cdf432bcaabf55e229ff6bdb53ca05b7955 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Mon, 3 Aug 2026 10:00:23 -0400 Subject: [PATCH 3/3] SS review --- test/asynchronous/test_client_backpressure.py | 2 +- test/test_client_backpressure.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_client_backpressure.py b/test/asynchronous/test_client_backpressure.py index 5149b9e3e1..94f22ac41c 100644 --- a/test/asynchronous/test_client_backpressure.py +++ b/test/asynchronous/test_client_backpressure.py @@ -356,7 +356,7 @@ async def test_05_overload_errors_with_basebackoffms_override_backoff(self, rand # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution - if sys.platform == "win32" and not _IS_SYNC: + if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12): exponential_expected = 0.55 base_backoff_expected = 0.25 else: diff --git a/test/test_client_backpressure.py b/test/test_client_backpressure.py index f37d9eea71..11fbbd92e6 100644 --- a/test/test_client_backpressure.py +++ b/test/test_client_backpressure.py @@ -354,7 +354,7 @@ def test_05_overload_errors_with_basebackoffms_override_backoff(self, random_fun # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution - if sys.platform == "win32" and not _IS_SYNC: + if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12): exponential_expected = 0.55 base_backoff_expected = 0.25 else: