Commit Graph
135 Commits
Author SHA1 Message Date
J. Nick KostonandGitHub 3ba3e3135e Fix flakey bootstrap test (#118285) 2024-05-28 08:11:14 +02:00
Jan-Philipp BeneckeandGitHub 5e194b8a82 Do not register mqtt mock config flow with handlers (#117521) 2024-05-15 16:17:27 -04:00
J. Nick KostonandGitHub f4e8d46ec2 Small speed ups to bootstrap tests (#117285) 2024-05-12 20:05:02 +09:00
Erik MontnemeryandGitHub 35900cd579 Use mock_config_flow helper in bootstrap tests (#117240) 2024-05-11 14:11:42 -04:00
J. Nick KostonandGitHub f73c55b434 Ensure mqtt handler is restored if its already registered in bootstrap test (#116549) 2024-05-01 20:22:18 +02:00
J. Nick KostonandGitHub 573cd8e94a Ensure mock mqtt handler is cleaned up after test_bootstrap_dependencies (#116544) 2024-05-01 19:45:47 +02:00
Erik MontnemeryandGitHub 764b34ab62 Reduce scope of bootstrap test fixture to module (#116195) 2024-04-25 22:00:07 -05:00
J. Nick KostonandGitHub d17e9bfc99 Enable debug mode if asyncio debug is on at startup (#116084) 2024-04-24 12:55:09 +02:00
J. Nick KostonandGitHub 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 KostonandGitHub 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

https://github.com/python/cpython/blob/1d3225ae056245da75e4a443ccafcc8f4f982cf2/Lib/logging/handlers.py#L189

* assert False is False
2024-04-05 22:00:09 -04:00
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
2024-03-26 00:02:16 +01:00
J. Nick KostonandGitHub e8cb6a8e29 Optimize loading of translations (#114089) 2024-03-23 22:22:09 -10:00
J. Nick KostonandGitHub 31fb02a71d Fix after deps not being considered for integrations before stage 1 (#114045) 2024-03-23 11:21:56 +01:00
J. Nick KostonandGitHub 952f47ab18 Combine recorder and frontend bootstrap step (#113985) 2024-03-22 13:50:39 -10:00
J. Nick KostonandGitHub 879e5bc961 Only wait for import flows in setup of there is a config flow (#113780) 2024-03-19 10:38:27 -10:00
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 <[email protected]>

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <[email protected]>

* Update homeassistant/setup.py

Co-authored-by: Martin Hjelmare <[email protected]>

* 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 <[email protected]>
2024-03-18 21:45:34 -04:00
J. Nick KostonandGitHub eb90c9a548 Reduce bottlenecks in bootstrap by ordering the setup of integrations (#113570) 2024-03-15 22:38:06 -10:00
Marc MuellerandGitHub a6b842f818 Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
J. Nick KostonandGitHub 5da629b3e5 Log waiting tasks in bootstrap that are delaying startup (#112637) 2024-03-07 13:18:18 -10:00
J. Nick KostonandGitHub b8e39bd968 Increase bootstrap preload test timeout (#112520) 2024-03-06 11:06:55 -10:00
J. Nick KostonandGitHub 87739bc072 Add test to ensure bootstrap continues if an integraton raises CancelledError (#112472) 2024-03-05 19:34:16 -10:00
J. Nick KostonandGitHub 40c0b4caf0 Import recorder and common recorder platforms before asyncio starts (#112131) 2024-03-03 22:03:30 -10:00
J. Nick KostonandGitHub 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ørensenandGitHub 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
2ef71289b9 Avoid creating tasks for dependencies already being setup (#111034)
Co-authored-by: Paulus Schoutsen <[email protected]>
2024-02-22 12:34:46 -10:00
Joakim SørensenandGitHub 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ørensenandGitHub 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 MuellerandGitHub 030727b078 Remove deprecated event_loop fixtures in tests (#109048) 2024-01-29 14:24:58 +01:00
80207835d7 Move core fundamental components into bootstrap (#105560)
Co-authored-by: Erik <[email protected]>
Co-authored-by: Martin Hjelmare <[email protected]>
2024-01-22 20:09:48 +01:00
Erik MontnemeryandGitHub 6908497c3d Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Franck NijhofandGitHub 7ec2980e52 Change pytest fixture scope from core fixtures (#104831) 2023-12-01 07:14:13 +01:00
Jan BouwhuisandGitHub 9962301b42 Do not notify config errors during logging (#104466) 2023-11-24 21:34:09 +01:00
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 <[email protected]>

* Follow up comments

* Add call_back decorator

* Split long lines

* Update exception abbreviations

---------

Co-authored-by: Erik Montnemery <[email protected]>
2023-11-24 17:34:45 +01:00
Jan BouwhuisandGitHub 3a42bd35e7 Test platform setup errors are notified (#104384)
Test setup errors are notified
2023-11-22 21:16:12 +01:00
Erik MontnemeryandGitHub 4536fb3541 Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +01:00
Erik MontnemeryandGitHub 97cc05d0b4 Make it possible to restart core in safe mode (#102606) 2023-10-24 14:47:58 +02:00
Erik MontnemeryandGitHub 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 MontnemeryandGitHub c481fdb7d0 Rename safe mode to recovery mode (#102580) 2023-10-23 20:33:08 +02:00
Marc MuellerandGitHub 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 BouwhuisandGitHub fc0c8bf113 Improve comment on patching the _import method in test bootstrap dependencies test (#91848) 2023-04-22 13:40:38 +02:00
Jan BouwhuisandGitHub 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 BouwhuisandGitHub 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
epenetandGitHub 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
J. Nick KostonandGitHub f60e9c71a2 Make bootstrap cancelation safe (#90420) 2023-03-28 11:22:41 -10:00
epenetandGitHub 81c0382e4b Fix lingering timer in bootstrap tests (#89790)
* Fix lingering timer in bootstrap test

* Adjust comment

* Use a constant
2023-03-16 17:20:27 -04:00
epenetandGitHub fec6236dd9 Add type hints to root tests (#89785) 2023-03-16 11:08:47 +01:00
epenetandGitHub a51cc75f03 Add type hints to core tests (part 2) (#88492) 2023-02-21 09:27:13 +01:00
4f6a25b470 Allow parameterizing YAML config in tests (#87981)
* Add fixture to parameterize yaml config

* Apply to more tests

* Re-add @fixture label

* Add fixtures to patch yaml content and targets

* Typo

* Improve docstr

Co-authored-by: epenet <[email protected]>

* Update references to mock_yaml_configuration

* Apply new fixtures

* Apply to check_config tests

* Follow up comments

* Rename fixtures, update docstr

* Split paths

* Patch load_yaml_config_file instead

* sort

* Fix tests

* improve docst

* Rename fixtures

* sorting

Co-authored-by: epenet <[email protected]>

* Improve docstr

Co-authored-by: epenet <[email protected]>

* Improve docstr

Co-authored-by: epenet <[email protected]>

* Improve docstr

Co-authored-by: epenet <[email protected]>

* Improve docstr

Co-authored-by: Erik Montnemery <[email protected]>

* Improve docstr

Co-authored-by: Erik Montnemery <[email protected]>

* Improve docstr

Co-authored-by: Erik Montnemery <[email protected]>

---------

Co-authored-by: epenet <[email protected]>
Co-authored-by: Erik Montnemery <[email protected]>
2023-02-20 16:57:12 +01:00
Paulus SchoutsenandGitHub d54f59478f Keep task references while running (#87970)
* Keep task references while running

* Update pilight tests pointing at correct logger call

* Fix graphite tests

* Fix profiler tests

* More graphite test fixes

* Remove extra sleep

* Fix tests

* Shutdown background tasks as part of stage 1

* Remove unnecessary sleep in test

* Remove unused method on mock hass

* Skip on cancelled too

* Remove background tasks

* Test trigger variables without actually sleeping

* Fix graphite

* One more graphite grrrrrrr
2023-02-13 23:16:59 -05:00
epenetandGitHub b7b82b1e3f Add more type hints to conftest.py (#87842)
* Add more type hints in conftest.py

* Adjust stop_hass

* Adjust mock_integration_frame

* Adjust pylint plugin
2023-02-11 13:48:53 +01:00