-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
FakeAsyncRedis stores state when clear instance expected. #293
Labels
bug
Something isn't working
Comments
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 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. |
This was referenced Mar 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: