From a92870e54efdf76ab305f864cfc16e3370bede71 Mon Sep 17 00:00:00 2001 From: Mohammed Alkindi Date: Sun, 16 Aug 2026 02:18:21 +0400 Subject: [PATCH] Fix timezone-dependent getDate timestamp test test_getDate_datetime_timestamp asserted a hardcoded date for a timestamp that getDate converts with datetime.fromtimestamp(), which uses the local timezone. The timestamp is 2019-10-19 20:01:46 UTC, so on any machine east of UTC+3:58 the local date is already 2019-10-20 and the test fails; CI never sees it because hosted runners are UTC. Assert the documented contract (number is a timestamp, converted to the local date) instead of one timezone's rendering of it. --- AUTHORS | 1 + tests/test_tablib_dbfpy_packages_utils.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index cd73e6574..0ae9d1deb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -31,6 +31,7 @@ Here is a list of past and present much-appreciated contributors: Matthew Hegarty Matthias Dellweg Mike Waldner + Mohammed Alkindi Nicholas Pilon Peyman Salehi Rabin Nankhwa diff --git a/tests/test_tablib_dbfpy_packages_utils.py b/tests/test_tablib_dbfpy_packages_utils.py index dd98db4ba..44003b68e 100644 --- a/tests/test_tablib_dbfpy_packages_utils.py +++ b/tests/test_tablib_dbfpy_packages_utils.py @@ -75,7 +75,12 @@ def test_getDate_datetime_timestamp(self): # Assert self.assertIsInstance(output, dt.date) - self.assertEqual(output, dt.date(2019, 10, 19)) + # getDate converts a number with datetime.fromtimestamp(), which uses + # the local timezone. This timestamp is 2019-10-19 20:01:46 UTC, so + # east of UTC+3:58 the local date is already 2019-10-20 — a hardcoded + # date makes the test fail for any contributor in those timezones. + # Assert the documented contract instead of one timezone's rendering. + self.assertEqual(output, dt.date.fromtimestamp(value)) def test_getDate_datetime_string_yyyy_mm_dd(self): # Arrange