From 1ca716c30d9ec23ba39048e07674b505e75a6e3e Mon Sep 17 00:00:00 2001 From: Bobby Noelte Date: Mon, 20 Jul 2026 01:12:28 +0200 Subject: [PATCH] fix(test): flaky test_datetimutil test case TC026 (#1158) This fix was taken from https://github.com/arneman/EOS/tree/refactor/economic-objective. Avoid flaky TC026 by comparing timestamps at assertion time. Signed-off-by: Bobby Noelte --- tests/test_datetimeutil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_datetimeutil.py b/tests/test_datetimeutil.py index 2f6272bd..9a629432 100644 --- a/tests/test_datetimeutil.py +++ b/tests/test_datetimeutil.py @@ -1204,7 +1204,11 @@ def test_to_datetime( # print(f"Result: {result} tz={result.timezone}") # print(f"Compare: {compare}") if expected_approximately: - assert compare.time_diff < 300 + # Compare using Unix timestamps to avoid pendulum timezone state + # issues and to prevent staleness from parametrize collection time. + import time + + assert abs(result.timestamp() - time.time()) < 300 else: assert compare.equal == True