You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
======================================================================
ERROR: test_expire_should_expire_key_by_aware_datetime (test_fakeredis.TestFakeRedis)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/fakeredis/test_fakeredis.py", line 2678, in test_expire_should_expire_key_by_aware_datetime
self.redis.set('foo', 'bar')
File "/fakeredis/fakeredis.py", line 315, in get
value = self._db.get(name)
File "/.virtualenvs/fakeredis/lib/python3.5/_collections_abc.py", line 597, in get
return self[key]
File "/fakeredis/fakeredis.py", line 116, in __getitem__
self._update_expired_keys()
File "/fakeredis/fakeredis.py", line 150, in _update_expired_keys
if now > self._ex_keys[key]:
TypeError: can't compare offset-naive and offset-aware datetimes
The text was updated successfully, but these errors were encountered:
A patch is certainly welcome, but I think redis-py will also do the wrong thing with an offset-aware datetime: it turns it into a UNIX timestamp using
when = int(mod_time.mktime(when.timetuple()))
and mktime assumes local time.
The best thing might be to first get a fix into redis-py so that it correctly deals with offset-aware datetimes, and then fakeredis can mimic the behaviour.
I think fakeredis probably needs a bit of an overhaul in its timestamp handling: it seems to use local time, which will do interesting things at DST changeovers.
Hi! Thanks for fakeredis!
There is a problem with timezone-aware datetimes. This test will fail on fakeredis but it pass on real one:
The text was updated successfully, but these errors were encountered: