mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
test_util: fix skip-on-32bit-platform behavior
I set up a raspberry pi buildslave (which, on the "raspbian jesse" image, uses a 32-bit python, and perhaps a 32-bit kernel too). It fails test_util.TimeFormat.test_format_time_y2038 with a ValueError inside the call to time.gmtime(). The test was looking for the equality check to fail instead. I think catching ValueError is the more-correct way to detect a system with a 32-bit time type.
This commit is contained in:
parent
5186e68f6b
commit
cffa682ddc
@ -1047,10 +1047,14 @@ class TimeFormat(unittest.TestCase, TimezoneMixin):
|
||||
def test_format_time_y2038(self):
|
||||
seconds_per_day = 60*60*24
|
||||
leap_years_1970_to_2047_inclusive = ((2044 - 1968) // 4)
|
||||
t = (seconds_per_day*
|
||||
((2048 - 1970)*365 + leap_years_1970_to_2047_inclusive))
|
||||
try:
|
||||
self.failUnlessEqual(time_format.format_time(time.gmtime(seconds_per_day*((2048 - 1970)*365+leap_years_1970_to_2047_inclusive))), '2048-01-01 00:00:00')
|
||||
except unittest.FailTest:
|
||||
gm_t = time.gmtime(t)
|
||||
except ValueError:
|
||||
raise unittest.SkipTest("Note: this system cannot handle dates after 2037.")
|
||||
self.failUnlessEqual(time_format.format_time(gm_t),
|
||||
'2048-01-01 00:00:00')
|
||||
|
||||
def test_format_delta(self):
|
||||
time_1 = 1389812723
|
||||
|
Loading…
x
Reference in New Issue
Block a user