Closed irusland closed 8 months ago
It is the intended behavior.
You can supply different connection parameters to get different fake servers.
Thanks for quick response!
Could you please provide me an example? Or point out the necessary code in documentation?
Solved it with using different each time port=...
import asyncio
import fakeredis
async def main():
redis_client_1 = fakeredis.FakeAsyncRedis(port=1)
await redis_client_1.set('k', 'v')
redis_client_2 = fakeredis.FakeAsyncRedis(port=2)
v2 = await redis_client_2.get('k')
assert v2 is None, f'Value of new redis is {v2}'
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Yeah, that works.
It behaves the same as redis.Redis
- by default the connection parameters are localhost:6389
.
Describe the bug When creating FakeAsyncRedis each time we get same instance of redis.
To Reproduce
produces
AssertionError: Value of new redis is b'v'
Expected behavior Code runs successfully same as
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Not sure if it's an intended behaviour. But anyways I expect same behaviour as
FakeRedis
Upvote & Fund