Commit graph

54 commits

Author SHA1 Message Date
epenet
22f5f59478
Use service_calls fixture in core platform tests [m-z] (#121001) 2024-07-02 12:34:11 +02:00
Marc Mueller
f11b316dac
Import Generator from collections.abc (4) (#120917) 2024-07-01 11:54:42 +02:00
epenet
ca8d3e0c83
Ignore unnecessary-lambda warnings in tests (#119564) 2024-06-13 16:58:41 +02:00
epenet
fb1b0058ee
Fix consider-using-tuple pylint warnings in component tests (#119464)
* Fix consider-using-tuple pylint warnings in component tests

* Apply su

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>

---------

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
2024-06-12 15:50:27 +02:00
epenet
2e3c3789d3
Use relative imports in tests [s-z] (#119283) 2024-06-10 13:33:15 +02:00
Marc Mueller
59e178df3b
Import Generator from typing_extensions (5) (#118993) 2024-06-06 17:33:27 +02:00
J. Nick Koston
ed0568c655
Ensure config entries are not unloaded while their platforms are setting up (#118767)
* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* run with error on to find them

* cert_exp, hold lock

* cert_exp, hold lock

* shelly async_late_forward_entry_setups

* compact

* compact

* found another

* patch up mobileapp

* patch up hue tests

* patch up smartthings

* fix mqtt

* fix esphome

* zwave_js

* mqtt

* rework

* fixes

* fix mocking

* fix mocking

* do not call async_forward_entry_setup directly

* docstrings

* docstrings

* docstrings

* add comments

* doc strings

* fixed all in core, turn off strict

* coverage

* coverage

* missing

* coverage
2024-06-04 21:34:39 -04:00
Sid
9bf87329da
Enable Ruff FLY002 rule (#115112)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-12 09:04:16 +02:00
Sid
d5f883fbf0
Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Jan-Philipp Benecke
dce3bde0ab
Use setup_test_component_platform helper for update entity component tests instead of hass.components (#114203)
* Use `setup_test_component_platform` helper for update entity component tests instead of `hass.components`

* Run ruff format
2024-03-26 20:20:08 +01: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
Sid
00ec7f11f0
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
J. Nick Koston
a50883d975
Run service call tasks eagerly (#112791) 2024-03-08 20:37:21 -10:00
Marc Mueller
87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
Joakim Sørensen
6da82cf07e
Use supported_features_compat in update.install service (#107224) 2024-01-05 10:38:54 +01:00
J. Nick Koston
4b6aaf6254
Update platform back-compat for custom components without UpdateEntityFeature (#106528) 2023-12-28 14:10:26 -10:00
J. Nick Koston
5156a93b9e
Add support for attribute caching to the update platform (#106261) 2023-12-23 10:29:55 +01:00
Erik Montnemery
d8baa38751
Use real devices in update device trigger tests (#102697) 2023-10-24 22:42:44 +02:00
Erik Montnemery
d1afcd773f
Revert "Cache entity properties that are never expected to change in the base class" (#100422)
Revert "Cache entity properties that are never expected to change in the base class (#95315)"

This reverts commit 042776ebb8.
2023-09-15 11:25:24 +02:00
J. Nick Koston
042776ebb8
Cache entity properties that are never expected to change in the base class (#95315) 2023-09-14 17:48:48 -05:00
Robert Resch
790523126e
Name unnamed update entities by their device class (#98579) 2023-08-18 13:40:35 +02:00
Erik Montnemery
a338e7e242
Use entity registry id in toggle_entity device automations (#94995)
* Use entity registry id in toggle_entity device automations

* Update tests

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-06-26 09:59:01 +02:00
Erik Montnemery
6183a36fce
Replace assert_lists_same with pytest_unordered in integrations t-z (#94903) 2023-06-20 20:23:49 +02:00
Erik Montnemery
4085c4f6d8
Tweak typing of Entity.platform (#88321)
* Tweak typing of Entity.platform

* Fix mypy errors

* Fix update test

* Improve comments
2023-06-09 10:56:04 +02:00
Jan Bouwhuis
ec98e22330
Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik Montnemery
3cca338c6e
Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
J. Nick Koston
d0d4ab6056
Require a list of entity ids when fetching history (#90992) 2023-04-08 16:14:44 -10:00
epenet
71dc98a39c
Improve hass_ws_client type hint in tests (#89703) 2023-03-14 16:31:40 +01:00
J. Nick Koston
1c57339ec3
Refactor recorder tests to use recorder history API (#89565) 2023-03-11 21:51:16 -05:00
epenet
9a5f88f55f
Add type hints to integration tests (part 23) (#88235) 2023-02-17 16:40:46 +01:00
Erik Montnemery
9989a4787b
Fix recorder platform tests (#88330) 2023-02-17 08:22:15 -06: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
G Johansson
8c00f435a6
Change name to entity_id update platform error messages (#87960) 2023-02-12 22:18:09 +01:00
Erik Montnemery
cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Franck Nijhof
51a9f65a01
Clean up unnecessary registry mocks from Core tests (#87726) 2023-02-08 13:28:44 -06:00
Erik Montnemery
31a787558f
Ensure recorder test fixture is setup before hass fixture (#80528)
* Ensure recorder test fixture is setup before hass fixture

* Adjust more tests
2022-10-19 07:58:47 +02:00
Erik Montnemery
5f2b4001f3
Separate recorder database schema from other classes (#72977)
* Separate recorder database schema from other classes

* fix logbook imports

* migrate new tests

* few more

* last one

* fix merge

Co-authored-by: J. Nick Koston <nick@koston.org>
2022-06-07 14:41:43 +02:00
Erik Montnemery
28ebab9c5a
Simplify waiting for recorder in tests (#70647) 2022-04-25 12:04:47 +02:00
Erik Montnemery
982e314de6
Use recorder_mock in tests (#70363)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-22 19:29:44 -10:00
Erik Montnemery
5e50a8abd5
Mark device triggers from hidden or auxiliary entities as secondary (#70335)
* Mark device triggers from hidden or auxiliary entities as secondary

* Update tests
2022-04-21 08:01:32 +02:00
Franck Nijhof
d65e12ab6e
Add clear_skipped service to update entity (#70116) 2022-04-19 16:11:16 +02:00
Franck Nijhof
c0e9cfedfb
Add device trigger support to Update entity (#69395) 2022-04-06 08:50:21 -07:00
Franck Nijhof
14a19aea03
Exclude update entity picture attribute from recorder (#69201) 2022-04-03 21:41:51 +02:00
Franck Nijhof
b644e7ed0f
Set brand icon as entity picture on update entities (#69200)
Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
2022-04-03 20:38:05 +02:00
Franck Nijhof
c31e788439
Rename current_version to installed_version in Update platform (#69093) 2022-04-01 20:11:17 +02:00
Joakim Sørensen
a81194cdd7
Add auto_update property to UpdateEntity (#69054) 2022-04-01 12:56:58 +02:00
J. Nick Koston
185aa025ac
Exclude large and chatty attributes from being recorded for update entities (#68940)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2022-03-31 14:28:19 +02:00
Joakim Sørensen
6d168d2672
Do not mark downgrades as updates (#68893) 2022-03-30 09:34:29 -07:00
Joakim Sørensen
9a150c2234
Add release_notes method to update entities (#68842) 2022-03-29 17:38:56 -07:00
Franck Nijhof
44d3a7e459
Adjust backup type of Update entity (#68553) 2022-03-23 11:20:04 +01:00