Fix cloud support package snapshots with verbose logging - #181399
Fix cloud support package snapshots with verbose logging#181399JamieMagee wants to merge 1 commit into
Conversation
|
Hey there @home-assistant/cloud, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test-only changes correctly suppress unstable logs without persistent side effects.
Review tier: Balanced
Findings: None
What changed in this PR
Stabilizes cloud support-package snapshots during verbose pytest runs.
Changes:
- Raises the event-bus logger threshold to
INFOin two snapshot tests. - Uses
caplogto restore logger state automatically.
| File | Description |
|---|---|
tests/components/cloud/test_http_api.py |
Prevents nondeterministic DEBUG logs from altering snapshots. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
justanotherariel
left a comment
There was a problem hiding this comment.
Hm. Have a look at test_download_support_package. I think this decorator is missing for the two tests you patched. This will also get rid of the This message will be dropped since this test patches MAX_RECORDS line in the snapshots which shouldn't have been there in the first place.
@patch("homeassistant.components.cloud.helpers.FixedSizeQueueLogHandler.MAX_RECORDS", 3)
|
|
||
| @pytest.mark.usefixtures("enable_custom_integrations") |
There was a problem hiding this comment.
| @patch("homeassistant.components.cloud.helpers.FixedSizeQueueLogHandler.MAX_RECORDS", 3) | |
| @pytest.mark.usefixtures("enable_custom_integrations") |
| caplog: pytest.LogCaptureFixture, | ||
| ) -> None: | ||
| """Test download support package when async_get_custom_components fails.""" | ||
|
|
||
| # Exclude setup logs with nondeterministic timestamps in verbose runs. | ||
| caplog.set_level(logging.INFO, logger="hass_nabucasa.events.bus") | ||
|
|
||
| aioclient_mock.get("https://cloud.bla.com/status", text="") |
There was a problem hiding this comment.
| caplog: pytest.LogCaptureFixture, | |
| ) -> None: | |
| """Test download support package when async_get_custom_components fails.""" | |
| # Exclude setup logs with nondeterministic timestamps in verbose runs. | |
| caplog.set_level(logging.INFO, logger="hass_nabucasa.events.bus") | |
| aioclient_mock.get("https://cloud.bla.com/status", text="") | |
| ) -> None: | |
| """Test download support package when async_get_custom_components fails.""" | |
| aioclient_mock.get("https://cloud.bla.com/status", text="") |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Breaking change
Proposed change
Verbose pytest runs add event-bus DEBUG messages with changing timestamps to two cloud support package snapshots.
Set
hass_nabucasa.events.bustoINFOin those tests withcaplog, which restores the logger level afterwards. The existing snapshots remain unchanged.Type of change
Additional information
All 501 cloud tests pass normally and with
-vvv. The three support package tests also pass with-vand--log-level=DEBUG. Ruff, Pylint and the applicable commit hooks pass.Checklist
ruff format 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.To help with the load of incoming pull requests: