From 3c4636482944eba89236ff36f737f40460f141c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 00:38:18 +0000 Subject: [PATCH] Use time.monotonic() instead of time.time() for fixture budget timing Addresses review feedback: monotonic clock is immune to NTP/clock adjustments that could skew the budget enforcement. Co-authored-by: larohra <41490930+larohra@users.noreply.github.com> --- .../azurefunctions/tests/integration_tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/packages/azurefunctions/tests/integration_tests/conftest.py b/python/packages/azurefunctions/tests/integration_tests/conftest.py index c3ee433534..56eb8d3a5f 100644 --- a/python/packages/azurefunctions/tests/integration_tests/conftest.py +++ b/python/packages/azurefunctions/tests/integration_tests/conftest.py @@ -544,11 +544,11 @@ def function_app_for_test(request: pytest.FixtureRequest) -> Iterator[dict[str, func_process: subprocess.Popen[Any] | None = None base_url = "" port = 0 - overall_start = time.time() + overall_start = time.monotonic() attempts_made = 0 for _ in range(max_attempts): - remaining = overall_budget - (time.time() - overall_start) + remaining = overall_budget - (time.monotonic() - overall_start) if remaining < 10: # Not enough time for another attempt; bail out. break @@ -571,7 +571,7 @@ def function_app_for_test(request: pytest.FixtureRequest) -> Iterator[dict[str, func_process = None if func_process is None: - elapsed = int(time.time() - overall_start) + elapsed = int(time.monotonic() - overall_start) error_message = f"Function app failed to start after {attempts_made} attempt(s) ({elapsed}s elapsed)." if last_error is not None: error_message += f" Last error: {last_error}"