Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

flushall() doesn't clean everything #185

Closed
kedder opened this issue Apr 3, 2018 · 2 comments
Closed

flushall() doesn't clean everything #185

kedder opened this issue Apr 3, 2018 · 2 comments

Comments

@kedder
Copy link

kedder commented Apr 3, 2018

When database contains expired keys, flushall() doesn't completely clean the database:

Python 2.7.14 (default, Sep 23 2017, 22:06:14) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fakeredis
>>> r = fakeredis.FakeStrictRedis()
>>> r.set('test', 1)
True
>>> r.set('test2', 2)
True
>>> r.expire('test', -1)
True
>>> r.flushall()
True
>>> r.get('test2')
'2'

The last sentece is expected to return None, because flushall() was executed before. However it left the test2 value around.

@bmerry
Copy link
Collaborator

bmerry commented Apr 3, 2018

I think this is a side-effect of #135 plus the way MutableMapping implements clear. I'm working on a fix now.

bmerry added a commit that referenced this issue Apr 3, 2018
@bmerry
Copy link
Collaborator

bmerry commented Apr 3, 2018

Fixed in 39553dc.

@bmerry bmerry closed this as completed Apr 3, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants