Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix racy homekit_controller platform setup caused by #22368 #22655
#22194 introduced some new homekit_controller tests and @balloob and @awarecan pointed out at least one of them was flaky. This doesn't happen in my config entry branch and i've now traced its root cause to #22368.
If the setup_platform runs before that happens you get the error in the test. This fix moves where we store the current HKDevice into hass.data so that it is always set before any further
This race is probably a real bug, not just a flaky test. So if #22368 is already in a tag or in an rc branch it might be worth applying the fix there too.
This is something of a temporary band aid - the buggy code is actually removed in my config entry branch and doesn't have this problem. The config entry branch won't trigger side effects in
**Related issue (if applicable): #22650
@@ Coverage Diff @@ ## dev #22655 +/- ## ======================================= Coverage 92.57% 92.57% ======================================= Files 457 457 Lines 36977 36977 ======================================= Hits 34232 34232 Misses 2745 2745