cunla / fakeredis-py

Implementation of Redis in python without having a Redis server running. Fully compatible with using redis-py.
https://fakeredis.moransoftware.ca/
BSD 3-Clause "New" or "Revised" License
298 stars 48 forks source link

fakeredis.aioredis.FakeRedis to support version selection #205

Closed steve-mavens closed 1 year ago

steve-mavens commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm still using Redis 6, so it would be useful to run tests in Redis 6 compatibility mode. This is supported for the blocking client, but doesn't work for the asyncio client:

>       async with fakeredis.aioredis.FakeRedis(decode_responses=True, version=6) as client:

tests\test_redis_client.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

...SNIPPED...

>       super().__init__(
            db=db,
            password=password,
            socket_timeout=socket_timeout,
            connection_pool=connection_pool,
            encoding=encoding,
            encoding_errors=encoding_errors,
            decode_responses=decode_responses,
            retry_on_timeout=retry_on_timeout,
            max_connections=max_connections,
            health_check_interval=health_check_interval,
            client_name=client_name,
            username=username,
            **kwargs,
        )
E       TypeError: Redis.__init__() got an unexpected keyword argument 'version'

\Lib\site-packages\fakeredis\aioredis.py:230: TypeError

Describe the solution you'd like

fakeredis.aioredis.FakeRedis to support the same version parameter as fakeredis.FakeRedis

Describe alternatives you've considered

redislite, testing against real redis instance. These are sub-optimal for the same reasons fakeredis in general is good.

steve-mavens commented 1 year ago

Thank you!