-
Notifications
You must be signed in to change notification settings - Fork 101
Polish #76
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
Polish #76
Conversation
return HeartbeatSender._instance | ||
|
||
async def start_ping(self): | ||
async def start_ping(self, test=False): |
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.
That's pretty clever. I hadn't considered refactoring in this sort of way to improve tests.
|
||
# Success case | ||
await new_ping._send_ping() # pylint: disable=protected-access | ||
await new_ping.start_ping(test=True) |
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.
Great improvement. Tests should definitely use the exposed methods, and not methods meant to be private/protected.
await new_ping._send_ping() # pylint: disable=protected-access | ||
assert mock_log_error.call_count == 2 | ||
await new_ping.start_ping(test=True) | ||
assert mock_log_error.call_count == 1 |
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.
Great improvement. Tests should definitely use the exposed methods, and not methods meant to be private/protected.
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.
LGTM! If code coverage and tests fully pass, we can merge this.
While testing I noticed that ping would timeout and then not restart, fixed that and then fixed the corresponding tests.