Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

rpush edge-case behaves differently between fakeredis and real redis. #187

Closed
smitelli opened this issue Apr 9, 2018 · 2 comments
Closed

Comments

@smitelli
Copy link

smitelli commented Apr 9, 2018

  • Python 3.5.3
  • Redis 3.2.6 server
  • fakeredis-0.10.2
  • redis-2.10.6

Test case:

from redis import StrictRedis
from fakeredis import FakeStrictRedis

redis = StrictRedis(host='localhost', port=6379, decode_responses=True)
fakeredis = FakeStrictRedis(decode_responses=True)
nothing = []

try:
    redis.rpush('testkey', *nothing)
    print('redis worked')
except:
    print('redis raised')

try:
    fakeredis.rpush('testkey', *nothing)
    print('fakeredis worked')
except:
    print('fakeredis raised')

Expected output:

redis raised
fakeredis raised

Actual output:

redis raised
fakeredis worked

Debates about whether or not it's appropriate to pass zero-length positional args this way, this is an inconsistency between fakeredis and real redis that bit us today. I would have to assume there are other commands that show similar differences, but I have not yet done an exhaustive search for them.

@bmerry
Copy link
Collaborator

bmerry commented Apr 9, 2018

Thanks for the report. At the moment I don't have much time to work on fakeredis (and I think neither does @jamesls), so the fastest way to get a fix in is to submit a pull request (with a test case). I'll be happy to review it.

There are almost certainly other similar cases (see #180 for example). If it applies to rpush then most likely it applies to lpush too.

@bmerry
Copy link
Collaborator

bmerry commented Jan 14, 2019

Should be fixed in 1.0rc1, which is a lot more careful than 0.x about empty argument lists.

@bmerry bmerry closed this as completed Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants