88 Commits

Author SHA1 Message Date
170e6bdcab Protect hass data keys in setup.py (#142589) 2025-04-09 15:27:52 +02:00
4813b5c882 Fix wait for a dependency with config entries (#142318)
* Fix wait for dependency with config entries

* test types

* test coverage

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2025-04-07 20:16:48 +02:00
c4f0d9d2fa Always set up after dependencies if they are scheduled to be loaded (#141593)
* Always setup after dependencies

* Add comment
2025-04-01 16:28:29 +02:00
7822e11894 Don't overwrite setup state in async_set_domains_to_be_loaded (#137547) 2025-02-06 15:18:37 +01:00
c1781cd793 Only raise missing integration issue for config entry integrations (#126654) 2024-09-24 18:26:01 +02:00
ba3872ff87 Add missing hass type in tests/*.py (#124048) 2024-08-18 15:42:41 +02:00
d2dd5ba0e6 Do not raise repair issue about missing integration in safe mode (#123066) 2024-08-02 13:38:56 +02:00
ad26db7dc8 Replace pylint broad-exception-raised rule with ruff (#123021) 2024-08-02 12:24:03 +02:00
075550b7ba Use HOMEASSISTANT_DOMAIN alias for core DOMAIN in tests (#122762) 2024-07-29 12:51:12 +02:00
3c14aa12ab Add repair issue when trying to set up unknown integration (#121089)
* Add repair issue when trying to set up unknown integration

* Add repair issue when trying to set up unknown integration

* Add repair issue when trying to set up unknown integration

* Fix

* Update homeassistant/components/homeassistant/strings.json

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* Update homeassistant/components/homeassistant/strings.json

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* Update homeassistant/setup.py

* Fix

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-07-06 15:02:58 +02:00
713abf4c6b Refactor PLATFORM_SCHEMA imports in tests (#120566) 2024-06-26 16:09:20 +02:00
dc6c1f4e87 Add MockPlatform type hints in tests (#120012)
* Add MockPlatform type hints in tests

* Remove useless code

* Improve

* Revert "Improve"

This reverts commit 9ad04f9255.
2024-06-21 11:04:15 +02:00
01be5d5f6b Move fixtures to decorators in core tests (#119675) 2024-06-14 13:32:42 +02:00
9f41133bbc Add missing argument type to core tests (#119667) 2024-06-14 08:42:01 +02:00
2a7e78a80f Ignore broad-exception-raised pylint warnings in tests (#119468) 2024-06-12 12:21:41 +02:00
149120b749 Add setup time detail to diagnostics (#117766) 2024-05-20 09:52:28 +02:00
3d700e2b71 Add HassDict implementation (#103844) 2024-05-07 10:53:13 +02:00
Sid
5f055a64bb Enable Ruff B017 (#115335) 2024-04-15 22:25:09 +02:00
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
e8cb6a8e29 Optimize loading of translations (#114089) 2024-03-23 22:22:09 -10:00
4f18f0d902 Fix setup timings when config entry platform loads are not awaited (#113959)
* Move setup time logging into the context manager

We were fetching the time twice but since the context
manager already has the timing, move it there

* remove log setup assertions from integration test

* tweak logging to give us better data for tracking issues

* redundant

* adjust

* preen

* fixes

* adjust

* make api change internal so nobody uses it

* coverage

* fix test

* fix more tests

* coverage

* more tests assuming internal calls

* fix more

* adjust

* adjust

* fix axis tests

* fix broadlink -- it does not call async_forward_entry_setup

* missed some

* remove useless patch

* rename, detect it both ways

* clear

* debug

* try to fix

* handle phase finishing out while paused

* where its set does not need to know its late as that is an implemenation detail of setup

* where its set does not need to know its late as that is an implemenation detail of setup

* tweak

* simplify

* reduce complexity

* revert order change as it makes review harder

* revert naming changes as it makes review harder

* improve comment

* improve debug

* late dispatch test

* test the other way as well

* Update setup.py

* Update setup.py

* Update setup.py

* simplify

* reduce
2024-03-23 15:26:38 -04: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 <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
7cb8a8bbc9 Migrate remaining calls in config modules to async_get_component (#112293)
* Migrate remaining calls in config modules to async_get_component

There were a few cases that were still using get_component that
could have done blocking I/O in the event loop, although it
was unlikely.

The caching check in async_get_component has been moved
up to avoid creating the future if the module is already in
the cache

* fix one more
2024-03-05 09:59:52 -05:00
1e173e82d0 Add support for preloading platforms in the loader (#112282)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-03-04 16:33:12 -10:00
60f81c8340 Fix async_prepare_setup_platform test (#112143) 2024-03-03 14:16:44 -10:00
d6cbadba3e Ensure setup loads top level component before platforms (#112057) 2024-03-03 11:42:16 -10:00
4ea1c5cc3c Add support for importing integrations in the executor (#111336)
* Add support for pre-imports at setup time

alternative solution to #111331

* refactor

* refactor

* refactor

* mark >1.0s integrations

* no point in executor if already loaded

* no point in executor if already loaded

* cleanup

* cleanup

* two more

* one more

* analytics loads a lot more integrations

* cloud

* debug

* psutil, hardwre

* try zha

* Update homeassistant/setup.py

* await

* comments

* coverage

* coverage

* coverage

* move logic to loader

* move logic to loader

* preserve comments
2024-02-26 14:49:43 -05:00
dd80157dc7 Load translations at setup time if they were not loaded at bootstrap (#110921) 2024-02-24 11:31:25 -10:00
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
def6c5c21c Refactor integration startup time tracking to reduce overhead (#110136)
* Refactor integration startup time tracking to reduce overhead

- Use monotonic time for watching integration startup time as it avoids incorrect values if time moves backwards because of ntp during startup and reduces many time conversions since we want durations in seconds and not local time

- Use loop scheduling instead of a task

- Moves all the dispatcher logic into the new _WatchPendingSetups

* websocket as well

* tweaks

* simplify logic

* preserve logic

* preserve logic

* lint

* adjust
2024-02-17 21:47:55 -05:00
84e74e4c74 Reverse component path (#104087)
* Reverse component path

* Update translations helper

* Fix

* Revert incorrect change of PLATFORM_FORMAT

* Fix use of PLATFORM_FORMAT in tts

* Fix ios
2023-12-05 08:43:58 +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 <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
3a42bd35e7 Test platform setup errors are notified (#104384)
Test setup errors are notified
2023-11-22 21:16:12 +01:00
67e25dc0bf Quote domain name in setup logs (#104239)
* Quote domain name in setup logs

* Update tests
2023-11-20 12:55:16 +01:00
4536fb3541 Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +01:00
8b662dc94f Detect attempt to setup config entry integration via YAML (#93589) 2023-05-29 21:01:47 +02:00
a51cc75f03 Add type hints to core tests (part 2) (#88492) 2023-02-21 09:27:13 +01:00
c98b4e3204 Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
bfbf9b9751 Adjusts imports in tests to match our relative import rules (#86788) 2023-01-27 12:51:58 +01:00
30bf0634fe Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
63d519c1a8 Spelling updates (#82867) 2022-11-28 16:51:43 +01:00
e7ca6b6e38 Highlight in logs it is a custom component when setup fails (#67559)
Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
2022-03-03 15:03:03 -08:00
24546dfdf9 Catch all exceptions on import component/platform (#64930) 2022-01-25 20:39:32 -08:00
7d85c00b91 Make setup tests async (#64456)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-01-19 12:47:21 -08:00
81e6ad0744 Replace http startup logic with async_when_setup_or_start (#48784) 2021-04-13 14:10:58 -07:00
12e3bc8101 Provide api to see which integrations are being loaded (#48274)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
52475c108f Make integration setup optional (#48381) 2021-03-29 13:53:47 -07:00
1fb9008488 Include platform only integrations in the manifest list api (#48269) 2021-03-29 12:51:48 +02:00
557ec374f1 Convert discovery helper to use dispatcher (#47008) 2021-02-24 13:37:31 -08:00
65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00