time in cookiejar.py tests reaches to far in to the future on some systems #4515
Closed
Description
Long story short
Regression of #1188
Expected behaviour
Tests pass on armv7l
Actual behaviour
Test run fails at test_cookiejar.py:383: OverflowError
Steps to reproduce
Run tests
Your environment
linux 4.19
nixos 20.03
arm v7l
python 3.7
aiohttp client-3.6.2
Log
ts_before = datetime.datetime(
1975, 1, 1, tzinfo=datetime.timezone.utc).timestamp()
ts_after = datetime.datetime(
2115, 1, 1, tzinfo=datetime.timezone.utc).timestamp()
cookies_sent = self.timed_request(
"http://expirestest.com/", ts_before, ts_before)
self.assertEqual(set(cookies_sent.keys()), {
"shared-cookie",
"expires-cookie"
})
cookies_sent = self.timed_request(
> "http://expirestest.com/", ts_before, ts_after)
test_cookiejar.py:590:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_cookiejar.TestCookieJarSafe testMethod=test_expires>
url = 'http://expirestest.com/'
update_time = datetime.datetime(1975, 1, 1, 0, 0), send_time = 4575744000.0
def timed_request(self, url, update_time, send_time):
if isinstance(update_time, int):
update_time = datetime.timedelta(seconds=update_time)
elif isinstance(update_time, float):
update_time = datetime.datetime.fromtimestamp(update_time)
if isinstance(send_time, int):
send_time = datetime.timedelta(seconds=send_time)
elif isinstance(send_time, float):
> send_time = datetime.datetime.fromtimestamp(send_time)
E OverflowError: timestamp out of range for platform time_t
test_cookiejar.py:383: OverflowError