]> granicus.if.org Git - python/commitdiff
Fix test_datetime on system with 32-bit time_t
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 10 Feb 2017 10:45:14 +0000 (11:45 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 10 Feb 2017 10:45:14 +0000 (11:45 +0100)
Issue #29100: Catch OverflowError in the new test_timestamp_limits() test.

Lib/test/datetimetester.py

index 7feabced94af18b62068b8669e6836201271ca64..42944a2d0698a7d033ee3568f5c7eb3dd300cb08 100644 (file)
@@ -1993,9 +1993,13 @@ class TestDateTime(TestDate):
         # minimum timestamp
         min_dt = self.theclass.min.replace(tzinfo=timezone.utc)
         min_ts = min_dt.timestamp()
-        # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800
-        self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
-                         min_dt)
+        try:
+            # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800
+            self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
+                             min_dt)
+        except OverflowError as exc:
+            # the date 0001-01-01 doesn't fit into 32-bit time_t
+            self.skipTest(str(exc))
 
         # maximum timestamp: set seconds to zero to avoid rounding issues
         max_dt = self.theclass.max.replace(tzinfo=timezone.utc,