Is there a way to programmatically add commands to fakeredis
?
Unless I'm missing something, the docs suggest directly modifying library code (FakeSocket
in _fakesocket.py
), which I wish to avoid.
Motivation:
I'm writing some unittests for an application which uses Redis-OM. My models are JsonModel
s, which cannot be instantiated without an active redis connection (their __init__
method checks that the Redis server supports Json).
I'm trying to work around this limitation by using FakeStrictRedis
. Unfortunately, it does not support the COMMAND INFO command which is used by JsonModel
.
Related questions:
fakeredis supports the RedisJson commands. You need to install it using the optional json flag.
The
COMMAND INFO
command is not implemented. You can open an issue describing the need and I'll see if I can implement it.If you wish to implement it and contribute it to the next version, that would be great!