-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
set default response_callbacks to redis.asyncio.cluster.ClusterNode #2201
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2201 +/- ##
=======================================
Coverage 91.99% 92.00%
=======================================
Files 108 108
Lines 27373 27377 +4
=======================================
+ Hits 25183 25189 +6
+ Misses 2190 2188 -2
Continue to review full report at Codecov.
|
+1. Would you be able to add a test as well? |
@utkarshgupta137 basically, If in the test case of I can check response_callbacks of ClusterNode is not None. but still, you can set response_callbacks to None at runtime. I don't think it's a meaningful test case. to prevent setting response_callbacks to None, there could be lots of ways. |
Even if response_callbacks is a dictionary, then it would fail at https://github.com/redis/redis-py/blob/master/redis/asyncio/cluster.py#L972. So you need to add a test along the lines of:
|
The test looks good. But its scope is not limited to just this argument. It would be better to merge it into test_startup_nodes. |
@utkarshgupta137 thank you for your advice 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rapidia Great catch, and a great PR, thank you!
Pull Request check-list
Please make sure to review and check all of these items:
$ tox
pass with this change (including linting)?NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
Please provide a description of the change here.
asyncio.cluster.ClusterNode
needs default response_callbacks, notNone
.When I initialize
RedisCluster
withstartup_nodes
(insteadhost=
andport=
),response_callbacks
of ClusterNode will beNone
, unless I specifyresponse_callbacks
.It could be assigned when create ClusterNode, but having default value looks more reasonable.