Commit graph

168 commits

Author SHA1 Message Date
Erik Montnemery 793b6aa97d
Allow passing version to ConfigEntry.async_update_entry (#110077)
Allow passing minor_version and version to ConfigEntry.async_update_entry
2024-02-09 10:10:25 +01:00
Erik Montnemery 2f15053311
Don't blow up if config entries have unhashable unique IDs (#109966)
* Don't blow up if config entries have unhashable unique IDs

* Add test

* Add comment on when we remove the guard

* Don't stringify hashable non string unique_id
2024-02-08 15:39:01 +01:00
Erik Montnemery ffdcdaf43b
Create issues for reauth flows (#109105) 2024-01-31 15:05:52 +01:00
J. Nick Koston dff5e45761
Small speed up to listing config entries in the websocket api (#108892) 2024-01-25 20:20:19 -10:00
Jan-Philipp Benecke 0b79504cf0
Extend config entry update/abort helper to also update unique id (#108681)
* Extend config entry update/abort helper to also update unique id

* Move kwarg to end

* Make additionals kwargs only
2024-01-22 23:01:55 +01:00
Jan-Philipp Benecke 988d72b8b6
Add helper function to update and reload config entry to config flow (#108034)
* Add helper function to update and reload config entry to config flow

* Use async_create_task

* Remove await

* Reload only when update & add task name

* Rename function
2024-01-22 17:40:20 +01:00
J. Nick Koston c399cab427
Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10:00
J. Nick Koston 3649cb96de
Refactor config entry storage and index (#107590) 2024-01-13 10:34:15 -10:00
Erik Montnemery 6908497c3d
Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Erik Montnemery 94fd7d0353
Improve test of config entry store (#105487)
* Improve test of config entry store

* Tweak test
2023-12-11 10:48:12 -05:00
Erik Montnemery 4536fb3541
Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +01:00
Franck Nijhof 70ad5ab3e4
Update helper tests to use device & entity registry fixtures (#103710) 2023-11-10 09:32:19 +01:00
J. Nick Koston 9b27552238
Fix race in starting reauth flows (#103130) 2023-10-31 12:38:05 -05:00
Erik Montnemery 4498c2e8c4
Validate steps in Flowhandler (#102152)
* Validate steps in Flowhandler

* Move validation to FlowManager._async_handle_step

* Fix _raise_if_not_has_step

* Fix config_entries tests

* Fix tests

* Rename

* Add test
2023-10-19 13:34:10 +02:00
J. Nick Koston b8f8cd1797
Reduce overhead to retry config entry setup (#99471) 2023-09-02 16:46:53 -05: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
J. Nick Koston 99e97782b6
Improve performance of abort_entries_match (#98932)
* Improve performance of abort_entries_match

In #90406 a ChainMap was added which called __iter__
and __contains__ which ends up creating temp dicts
for matching

174e9da083/Lib/collections/__init__.py (L1022)

We can avoid this by removing the ChainMap since there
are only two mappings to match on.

This also means options no longer obscures data

* adjust comment
2023-08-24 15:34:45 +02:00
Erik Montnemery d282ba6bac
Use a single WS command for group preview (#98903)
* Use a single WS command for group preview

* Fix tests
2023-08-24 11:59:24 +02:00
Erik Montnemery b885dfa5a8
Add preview to sensor group config and option flows (#83638) 2023-08-22 10:29:16 +02:00
J. Nick Koston 1adfa6bbeb
Reduce overhead to start a config entry flow by optimizing fetching the handler (#97883) 2023-08-06 20:25:03 -10:00
J. Nick Koston 34b725bb99
Debounce discoveries to improve event loop stability at the started event (#94690)
* Debounce discoveries to improve event loop stability at the started event

The first one is immediate and anything that fires within the next
second will be debounced to only happen once every second

* fix mock
2023-06-15 22:15:07 -04:00
Ville Skyttä c7c4ee13c3
Import util.dt as dt_util in remaining tests, enforce with ruff (#93765)
* Import `util.dt` as `dt_util` in remaining tests, enforce with ruff

* Fix `util.dt` import in pvpc_hourly_pricing tests
2023-05-30 23:30:31 +03:00
J. Nick Koston 48485fc2bf
Complete persistent notifications migration (#92828)
* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
2023-05-25 23:09:13 -04:00
Erik Montnemery 63f3767a29
Include UUID in hassio discovery data (#91970) 2023-04-25 09:48:47 +02:00
J. Nick Koston 739963b5ee
Remove deprecated async_setup_platforms (#91929) 2023-04-23 22:38:35 -05:00
epenet 3364f0fce2
Allow config entries unload action to be coroutine (#91531)
* Allow config entries unload action to be coroutine

* Adjust comment
2023-04-17 08:41:25 -04:00
epenet f7925763a4
Make abort_entries_match available in options flow (#90406)
* Make abort_entries_match available in options flow

* Add tests

* Exclude ignore entries and add test

* Move to OptionsFlow

* Adjust tests

* Use mock_config_flow

* Use AbortFlow

* Remove duplicate code
2023-03-29 17:20:51 +02:00
Erik Montnemery 3931e11fd9
Try to load integration before starting option flow (#90111)
* Try to load integration before starting option flow

* Adjust tests
2023-03-22 20:10:10 +01:00
epenet fec6236dd9
Add type hints to root tests (#89785) 2023-03-16 11:08:47 +01:00
epenet 8a58457203
Fix lingering timer in config entries test (#89787) 2023-03-16 11:07:42 +01:00
J. Nick Koston f8934175cb
Prevent integrations from retrying setup once shutdown has started (#88818)
* Prevent integrations from retrying setup once shutdown has started

* coverage
2023-02-26 22:01:02 -05:00
epenet a51cc75f03
Add type hints to core tests (part 2) (#88492) 2023-02-21 09:27:13 +01:00
Paulus Schoutsen 3a32d2bdcb
Add background tasks to config entries (#88335)
* Use a set for config entries task tracking

* Allow adding background tasks to config entries

* Add tests for config entry add tasks

* Update docstrings on core create task

* Migrate roon and august

* Use in more places

* Guard for None
2023-02-17 13:50:05 -05:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Paulus Schoutsen 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
Franck Nijhof 80bf632e2d
Clean up unnecessary registry mocks from helpers (#87734) 2023-02-08 20:15:29 -05:00
epenet 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
Franck Nijhof 5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Franck Nijhof bfbf9b9751
Adjusts imports in tests to match our relative import rules (#86788) 2023-01-27 12:51:58 +01:00
Franck Nijhof 24fdd588fd
Code styling tweaks to the tests - Part 1 (#86192) 2023-01-20 13:52:46 +01:00
Erik Montnemery f17a829bd8
Only wait for import flows to initialize at setup (#86106)
* Only wait for import flows to initialize at setup

* Update hassio tests

* Update hassio tests

* Apply suggestions from code review

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-01-18 10:44:18 +01:00
Erik Montnemery 3cd6bd87a7
Remove config entry specifics from FlowManager (#85565) 2023-01-17 15:26:17 +01:00
J. Nick Koston 4296f227cf
Fix thundering heard in setup_again when there are many integrations (#84670) 2022-12-27 15:59:42 -10:00
Franck Nijhof c715035016
Add support for raising ConfigEntryError (#82689) 2022-11-25 11:33:03 +01:00
epenet 4c38a5d773
Add OptionsFlow helper class (#82531)
* Add OptionsFlow helper classes

* More integrations

* Adjust SchemaOptionsFlowHandler

* Use single class

* Simplify access to options

* Reduce PR

* Make _options private

* Add test
2022-11-24 12:18:09 +01:00
Jan Bouwhuis c720742ec9
Revert #81771 (wait_for_states) and #81801 (late review) (#82085)
* Revert "Address late review of config entry wait for states tests (#81801)"

This reverts commit 12d76a8a4f.

* Revert "Implement ConfigEntry async_wait_for_states (#81771)"

This reverts commit 3cc9ecf1dc.
2022-11-18 17:16:03 +01:00
Erik Montnemery 1a274adc28
Add config_entries.async_wait_component (#76980)
Co-authored-by: thecode <levyshay1@gmail.com>
2022-11-17 21:52:57 +01:00
Aaron Bach adf84b0c62
Add async_get_active_reauth_flows helper for config entries (#81881)
* Add `async_get_active_reauth_flows` helper for config entries

* Code review

* Code review + tests
2022-11-09 15:36:50 -07:00
J. Nick Koston f9ff23a2c8
Fix benign typo in test_config_entries.py (#81789)
* Fix typo in test_config_entries.py

* touch ups

* Update tests/test_config_entries.py

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

Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-11-09 16:36:46 +01:00
Jan Bouwhuis 12d76a8a4f
Address late review of config entry wait for states tests (#81801)
* Late review on tests #81771

* Clean-up duplicate assignment
2022-11-08 22:14:17 +01:00