diff --git a/test/asynchronous/test_client_backpressure.py b/test/asynchronous/test_client_backpressure.py index b0cfb54b1e..94f22ac41c 100644 --- a/test/asynchronous/test_client_backpressure.py +++ b/test/asynchronous/test_client_backpressure.py @@ -354,8 +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. - self.assertGreaterEqual(exponential_backoff_time, 0.6) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.3) + + # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution + if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12): + 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 fe510a93fb..11fbbd92e6 100644 --- a/test/test_client_backpressure.py +++ b/test/test_client_backpressure.py @@ -352,8 +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. - self.assertGreaterEqual(exponential_backoff_time, 0.6) - self.assertGreaterEqual(with_base_backoff_ms_time, 0.3) + + # Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution + if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12): + 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)