Fix possibility of Passing Multiple Redis Instances to the Store #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
It turns out, as reported by @wasperen2 in issue #29, that it is possible to pass two Redis instances to the
Store
on initialization inStore(redis_config=..., redis_store=...)
. Allowing this to happen can cause all sorts of unexpected results. Currently, the redis instance constructed from the "redis_config" argument overwrites the value passed via "redis_store".This should close #29 if @wasperen2 confirms that mocking using redislite the way it was done in the
test/conftest.py
is sufficient for their need.What was Done
The expectation was to have only one way of initializing the redis instance, that is, via the "redis_config" argument.
This pull request attempts to remove the ambiguity caused by the extra argument "redis_store" by removing it and changing the
Store.redis_store
property to a readonly property.