-
Notifications
You must be signed in to change notification settings - Fork 14
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
using any passed Redis instance #29
Comments
Oops 🙊. We probably should have made the |
For passing a mock redis instance, @wasperen2 , in your use case, are you able to use the way it was done in the i.e.
|
Closed this as fixed by the another pull request, assuming the solution provided in the previous comment handles @wasperen2 use case |
As per my comments, can we please reconsider this and stick with the option to do Dependency Injection (https://en.wikipedia.org/wiki/Dependency_injection)? Having that ability makes your package play better with larger systems where injecting core services is common. This results in more cohesive code and a more standard way of deploying and testing. |
(it would also not introduce a breaking change :)) |
@wasperen2 I think we should close the current issue first, which is the ambiguity problem. #35 closes this sufficiently because it is in line with the original idea of how the store were to be initialized (as can be seen in all current examples and tests). We can then take your suggestion for ability to pass in a pre-constructed redis instance as new feature request. |
Describe the bug
One can pass a Redis instance when a new Store is created. And, although
self.redis_store
is initially set to that value, it is brutally overwritten by a new Redis instance created from the passed config.This makes it harder to pass in a Mock Redis instance for creating unit tests. It is also unexpected behavior.
To Reproduce
Expected behavior
I would expect the Redis store that I passed in, to be used rather than another one.
The text was updated successfully, but these errors were encountered: