Always consume the no_throttle keyword argument.#11126
Merged
balloob merged 1 commit intohome-assistant:devfrom Dec 14, 2017
Merged
Always consume the no_throttle keyword argument.#11126balloob merged 1 commit intohome-assistant:devfrom
balloob merged 1 commit intohome-assistant:devfrom
Conversation
The current code relies on the assumption that the first invocation will never specify no_throttle=True.
However that puts us in a pickle when writing unit tests: if we had a fictitious:
def setup_platform():
update()
@Throttle(MIN_TIME_BETWEEN_SCANS)
def update():
pass
Then given multiple tests, the second and some of subsequent tests would be throttled (depending on timing).
But we also can't change that code to call `update(no_throttle=True)' because that's not currently accepted.
This diff shouldn't change the visibile behavior of any component, but allows this extra flexibility.
6 tasks
Contributor
Author
|
@balloob this fixes a bug in my previous diff, would you merge? |
akatrevorjay
added a commit
to akatrevorjay/home-assistant
that referenced
this pull request
Dec 15, 2017
…into dev * 'dev' of https://github.com/home-assistant/home-assistant: Disable html5 notify dependency (home-assistant#11135) ISY994 sensor improvements (home-assistant#10805) Allow using more than one keyboard remote (home-assistant#11061) set default utc offset to 0 (home-assistant#11114) Add problem device class (home-assistant#11130) Always consume the no_throttle keyword argument. (home-assistant#11126) Skip HASS emulated Hue bridges from detection. (home-assistant#11128) update pyripple (home-assistant#11122) Add media position properties (home-assistant#10076) Fixed typo in automation.py (home-assistant#11116)
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current code relies on the assumption that the first invocation will never specify no_throttle=True.
However that puts us in a pickle when writing unit tests: if we had a fictitious:
def setup_platform():
update()
@Throttle(MIN_TIME_BETWEEN_SCANS)
def update():
pass
Then given multiple tests, the second and some of subsequent tests would be throttled (depending on timing).
But we also can't change that code to call `update(no_throttle=True)' because that's not currently accepted.
This diff shouldn't change the visibile behavior of any component, but allows this extra flexibility.
Description:
Related issue (if applicable): fixes #11125
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests pass