Add constant for PlatformNotReady wait time to use in tests #37266
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.
Proposed change
When a platform returns a
PlatformNotReady
exception thenentity_platform.py
handles it by waiting for 30 seconds * number of setup attempts before trying again. When testing this behavior in tests the recommendation is to try and setup the platform while forcing a failure, fix the failure, advance time, and see that is has been setup.Since "30 seconds" was simply hard-coded into the logic tests are currently forced to advance time an arbitrarily long amount of time to ensure it was enough to satisfy this wait time (I saw code adding a few minutes generally). Thought it would be preferable to refactor this into a constant so tests can advance time by exactly that.
Also adjusted the InfluxDB sensor tests to import this new constant instead of creating it itself now that it is available. Just since that was the test I was working on that made me want this :)
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: