8000 Fix flaky updater tests by andrewsayre · Pull Request #26221 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix flaky updater tests #26221

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

Merged
merged 1 commit into from
Aug 27, 2019
Merged

Fix flaky updater tests #26221

merged 1 commit into from
Aug 27, 2019

Conversation

andrewsayre
Copy link
Member

Description:

Fixes an issue where dt_util.utcnow was not properly being patch in the updater tests, which (I believe) resulted in periodic failures. Also updates the code in the file to use the async keywords and some linting. No functional changes to code.

Related issue (if applicable): fixes #26187

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]

"""Fixture to mock utcnow."""
with patch("homeassistant.components.updater.dt_util.utcnow") as mock:
Copy link
Member Author
@andrewsayre andrewsayre Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the root of the issue was. The tests weren't even using the fixture, probably because the patch wasn't working. I'm not sure why this didn't work (it does in other places in the tests, but none of those were in a fixture), but when debugging I could see it wasn't mocking. Changing it to the module then returning the method inside the yield fixed the issue.

Copy link
Member
@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MartinHjelmare MartinHjelmare merged commit 9dc4019 into dev Aug 27, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix_updater_tests branch August 27, 2019 08:30
@lock lock bot locked and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed core has-tests small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky Updater Test
3 participants
0