Skip to content

Conversation

justinmerrell
Copy link
Contributor

While testing I noticed that ping would timeout and then not restart, fixed that and then fixed the corresponding tests.

@justinmerrell justinmerrell requested a review from Jorghi12 July 31, 2023 19:20
return HeartbeatSender._instance

async def start_ping(self):
async def start_ping(self, test=False):
Copy link
Contributor

@Jorghi12 Jorghi12 Jul 31, 2023

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)
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

@Jorghi12 Jorghi12 left a 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.

@justinmerrell justinmerrell merged commit 5b1652f into main Jul 31, 2023
@justinmerrell justinmerrell deleted the polish branch July 31, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants