Commit Graph

142 Commits (8017bc6776c6826c0a3b485f167c38906c33a5fb)

Author SHA1 Message Date
Erik Montnemery b8b7c23258
Create log files in an executor thread (#120912) 2024-07-02 15:48:35 +02:00
Marc Mueller ca55986057
Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
epenet f0dc39a903
Improve typing in core tests (#119958)
Add missing return values in core tests
2024-06-19 19:58:07 +02:00
epenet 01be5d5f6b
Move fixtures to decorators in core tests (#119675) 2024-06-14 13:32:42 +02:00
J. Nick Koston d52ce03aa4
Ensure asyncio blocking checks are undone after tests run (#119542)
* Ensure asyncio blocking checks are undone after tests run

* no reason to ever enable twice

* we are patching objects, make it more generic

* make sure bootstrap unblocks as well

* move disable to tests only

* re-protect

* Update tests/test_block_async_io.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Revert "Update tests/test_block_async_io.py"

This reverts commit 2d46028e21.

* tweak name

* fixture only

* Update tests/conftest.py

* Update tests/conftest.py

* Apply suggestions from code review

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-06-13 08:52:01 +02:00
epenet 1c8a9cc3b8
Remove unused caplog fixtures in tests (#119056) 2024-06-07 11:38:56 +02:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
J. Nick Koston 3ba3e3135e
Fix flakey bootstrap test (#118285) 2024-05-28 08:11:14 +02:00
Jan-Philipp Benecke 5e194b8a82
Do not register mqtt mock config flow with handlers (#117521) 2024-05-15 16:17:27 -04:00
J. Nick Koston f4e8d46ec2
Small speed ups to bootstrap tests (#117285) 2024-05-12 20:05:02 +09:00
Erik Montnemery 35900cd579
Use mock_config_flow helper in bootstrap tests (#117240) 2024-05-11 14:11:42 -04:00
J. Nick Koston f73c55b434
Ensure mqtt handler is restored if its already registered in bootstrap test (#116549) 2024-05-01 20:22:18 +02:00
J. Nick Koston 573cd8e94a
Ensure mock mqtt handler is cleaned up after test_bootstrap_dependencies (#116544) 2024-05-01 19:45:47 +02:00
Erik Montnemery 764b34ab62
Reduce scope of bootstrap test fixture to module (#116195) 2024-04-25 22:00:07 -05:00
J. Nick Koston d17e9bfc99
Enable debug mode if asyncio debug is on at startup (#116084) 2024-04-24 12:55:09 +02:00
J. Nick Koston 53a179088f
Add debug mode to catch unsafe thread operations using core helpers (#115390)
* adjust

* adjust

* fixes

* one more

* test

* debug

* move to config

* cover

* Update homeassistant/core.py

* set debug from RuntimeConfig

* reduce

* fix message

* raise

* Update homeassistant/core.py

* Update homeassistant/core.py

* no flood check for raise

* cover
2024-04-24 03:36:05 +02:00
J. Nick Koston bf5cf382dc
Avoid useless stat() syscalls for every logger record (#114987)
* Avoid useless stat() syscalls for every logger record

shouldRollover will always return False since we do
not use maxBytes as we are only using RotatingFileHandler
for the backupCount option. Since every log record will
stat the log file to see if it exists and if its a normal
file, we can override the shouldRollover to reduce the
logging overhead quite a bit

1d3225ae05/Lib/logging/handlers.py (L189)

* assert False is False
2024-04-05 22:00:09 -04:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
J. Nick Koston e8cb6a8e29
Optimize loading of translations (#114089) 2024-03-23 22:22:09 -10:00
J. Nick Koston 31fb02a71d
Fix after deps not being considered for integrations before stage 1 (#114045) 2024-03-23 11:21:56 +01:00
J. Nick Koston 952f47ab18
Combine recorder and frontend bootstrap step (#113985) 2024-03-22 13:50:39 -10:00
J. Nick Koston 879e5bc961
Only wait for import flows in setup of there is a config flow (#113780) 2024-03-19 10:38:27 -10:00
J. Nick Koston c615b52840
Refactor integration startup time to show wall clock time (#113707)
* Refactor setup time tracking to exclude time waiting on other operations

We now exclude the import time and th time waiting on
base platforms to setup from the setup times

* tweak

* tweak

* tweak

* tweak

* adjust

* fixes

* fixes

* preen

* preen

* tweak

* tweak

* adjust

* tweak

* reduce

* do not count integrtion platforms against their parent integration

* handle legacy tts platforms

* stt as well

* one more wait

* use the same pattern in all the legacy

* fix tts and stt legacy

* fix

* fix

* reduce

* preen

* entity comp does not wait for platforms

* scene blocks as well

* fix test

* test fixes

* coverage

* coverage

* coverage

* fix test

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* strip

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* remove complexity

* Apply suggestions from code review

* no longer works that way

* fixes

* fixes

* fixes

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-03-18 21:45:34 -04:00
J. Nick Koston eb90c9a548
Reduce bottlenecks in bootstrap by ordering the setup of integrations (#113570) 2024-03-15 22:38:06 -10:00
Marc Mueller a6b842f818
Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
J. Nick Koston 5da629b3e5
Log waiting tasks in bootstrap that are delaying startup (#112637) 2024-03-07 13:18:18 -10:00
J. Nick Koston b8e39bd968
Increase bootstrap preload test timeout (#112520) 2024-03-06 11:06:55 -10:00
J. Nick Koston 87739bc072
Add test to ensure bootstrap continues if an integraton raises CancelledError (#112472) 2024-03-05 19:34:16 -10:00
J. Nick Koston 40c0b4caf0
Import recorder and common recorder platforms before asyncio starts (#112131) 2024-03-03 22:03:30 -10:00
J. Nick Koston 08897137ff
Pre-import more frontend deps to avoid importing when the event loop is running (#112031) 2024-03-02 13:44:06 -10:00
Joakim Sørensen f622ddef47
Move backup/* WS commands to the backup integration (#111636)
Revert "Revert "Move backup/* WS commands to the backup integration" (#111136)"

This reverts commit 8f83426895.
2024-02-27 11:56:07 -05:00
J. Nick Koston 2ef71289b9
Avoid creating tasks for dependencies already being setup (#111034)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-02-22 12:34:46 -10:00
Joakim Sørensen 8f83426895
Revert "Move backup/* WS commands to the backup integration" (#111136)
Revert "Move backup/* WS commands to the backup integration (#110651)"

This reverts commit ec4e6c3a74.
2024-02-22 16:08:30 +01:00
Joakim Sørensen ec4e6c3a74
Move backup/* WS commands to the backup integration (#110651)
* Move backup/* WS commands to the backup integration

* Call correct command

* Use debug for logging

* Remove assertion of hass.data for setup test

* parametrize token fixture
2024-02-22 10:25:38 +01:00
Marc Mueller 030727b078
Remove deprecated event_loop fixtures in tests (#109048) 2024-01-29 14:24:58 +01:00
Franck Nijhof 80207835d7
Move core fundamental components into bootstrap (#105560)
Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-01-22 20:09:48 +01:00
Erik Montnemery 6908497c3d
Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Franck Nijhof 7ec2980e52
Change pytest fixture scope from core fixtures (#104831) 2023-12-01 07:14:13 +01:00
Jan Bouwhuis 9962301b42
Do not notify config errors during logging (#104466) 2023-11-24 21:34:09 +01:00
Jan Bouwhuis af71c2bb45
Raise and suppress stack trace when reloading yaml fails (#102410)
* Allow async_integration_yaml_config to raise

* Docstr - split check

* Implement as wrapper, return dataclass

* Fix setup error handling

* Fix reload test mock

* Move log_messages to error handler

* Remove unreachable code

* Remove config test helper

* Refactor and ensure notifications during setup

* Remove redundat error, adjust tests notifications

* Fix patch

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Follow up comments

* Add call_back decorator

* Split long lines

* Update exception abbreviations

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 17:34:45 +01:00
Jan Bouwhuis 3a42bd35e7
Test platform setup errors are notified (#104384)
Test setup errors are notified
2023-11-22 21:16:12 +01:00
Erik Montnemery 4536fb3541
Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +01:00
Erik Montnemery 97cc05d0b4
Make it possible to restart core in safe mode (#102606) 2023-10-24 14:47:58 +02:00
Erik Montnemery b953f2998c
Rename the safe_mode integration to recovery_mode (#102581)
* Rename safe mode integration to recovery mode

* Update code
2023-10-24 09:11:14 +02:00
Erik Montnemery c481fdb7d0
Rename safe mode to recovery mode (#102580) 2023-10-23 20:33:08 +02:00
Marc Mueller 544d6b05a5
Replace mock_coro with AsyncMock (#99014)
* Replace mock_coro with AsyncMock

* Remove mock_coro test helper function

* Remove redundant AsyncMock
2023-08-25 22:54:55 +02:00
Jan Bouwhuis fc0c8bf113
Improve comment on patching the _import method in test bootstrap dependencies test (#91848) 2023-04-22 13:40:38 +02:00
Jan Bouwhuis 4de124cdd5
Follow up on comments on changes bootstrap tests (#91803)
* Remove commented code

* Add comment to explain mock

* typo
2023-04-21 21:44:14 +03:00
Jan Bouwhuis da26b0a930
Ensure dependencies are awaited correctly when setting up integrations (#91454)
* Do not wait

* Correct tests

* Manage after dependencies stage 1

* test bootstrap dependencies

* Assert log the dependenciy is waited for

* Improve docstrings

* Assert outside callback

* Patch async_get_integrations

* Revert changes made to snips integration

* Undo changes to mqtt_statestream
2023-04-21 08:33:50 +02:00
epenet 9705607db4
Fix lingering timer in cloud (#90822)
* Fix lingering timer in cloud

* Rename variable

* Improve

* Improve again

* Adjust

* Adjust

* Add property to HassJob instead

* Adjust

* Rename

* Adjust

* Adjust

* Make it read-only

* Add specific test
2023-04-07 11:38:17 +02:00