Commit Graph

208 Commits

Author SHA1 Message Date
epenet
07f095aa42 Use service_calls fixture in core platform tests [a-l] (#120904) 2024-07-01 19:27:50 +02:00
Marc Mueller
2f0dd6f704 Import Generator from collections.abc (2) (#120915) 2024-07-01 11:58:49 +02:00
epenet
abb8c58b87 Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
Marc Mueller
279483ddb0 Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +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
epenet
7e62061b9a Improve typing for calls fixture in tests (a-l) (#118349)
* Improve typing for `calls` fixture in tests (a-l)

* More

* More
2024-05-29 09:06:48 +02: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
6313571fbc Use setup_test_component_platform helper for binary_sensor entity component tests instead of hass.components (#114293) 2024-03-27 14:24:02 +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
Marc Mueller
cb8c14496c Use more f-strings [ruff] (#112695) 2024-03-08 18:44:42 +01:00
Marc Mueller
38adfbf1a3 Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
Erik Montnemery
c805ea7b4f Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
Robert Resch
db985925c4 Deprecate deprecated automation constants (#106067) 2023-12-19 19:22:13 +01:00
Robert Resch
0e0fd39603 Add dir_with_deprecated_constants function to deprecation helper (#106059) 2023-12-19 16:37:21 +01:00
Robert Resch
a4ccd6e13b Deprecate binary sensor device class constants (#105736)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-12-19 12:45:32 +01:00
Jan Bouwhuis
a66c9bb7b6 Update stale doc strings in entity platform tests (#105526) 2023-12-12 08:28:08 +01:00
Jan Bouwhuis
5dd787aa10 Validate entity category for binary_sensor (#103464) 2023-11-06 10:34:06 +01:00
Erik Montnemery
9d3cdc85ca Use real devices in binary_sensor device condition tests (#102704) 2023-10-24 23:28:29 +02:00
Erik Montnemery
acc5edb088 Use real devices in binary_sensor device trigger tests (#102678) 2023-10-24 21:56:53 +02:00
Erik Montnemery
f0493b22d4 Use entity registry id in binary_sensor device conditions (#95251) 2023-06-26 18:17:27 +02:00
Erik Montnemery
4414f06ed2 Teach binary_sensor device trigger about entity registry ids (#94963)
* Teach binary_sensor device trigger about entity registry ids

* Update deconz test
2023-06-21 14:49:53 +02:00
Erik Montnemery
6a29ed8caa Replace assert_lists_same with pytest_unordered in integrations a-f (#94900) 2023-06-20 20:22:31 +02:00
Erik Montnemery
92bba4d7be Fix typo in binary_sensor tests (#94712) 2023-06-16 13:57:42 +02:00
Erik Montnemery
2406b235b4 Name unnamed binary sensors by their device class (#92940)
* Name unnamed binary sensors by their device class

* Update type annotations

* Fix loading of entity component translations

* Add test

* Update integrations

* Set abode and rfxtrx binary_sensor name to None

* Revert changes in homekit_controller
2023-06-13 19:48:54 +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
da5ad4a17d Update binary_sensor tests to avoid patching utcnow (#93474) 2023-05-24 13:17:11 -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
epenet
0cf5e9fb4a Add type hints to integration tests (part 2) (#87789)
* Add type hints to integration tests (part 2)

* typo

* Improve analytics

* Improve automation

* Imrpove bluetooth
2023-02-10 16:05:26 +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
epenet
4142f0d15d Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
epenet
aa00114c2f Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Erik Montnemery
4655ed995e Fix resetting of attributes in EntityRegistry.async_get_or_create (#77516)
* Fix resetting of attributes in EntityRegistry.async_get_or_create

* Fix typing

* Fix resetting config entry

* Improve test

* Update tests
2022-08-30 21:07:50 +02: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
Erik Montnemery
150f173eed Mark device conditions from hidden or auxiliary entities as secondary (#70333) 2022-04-20 21:41:59 +02:00
epenet
411fcad798 Use BinarySensorDeviceClass enum in binary_sensor device automations (#62635) 2022-01-04 16:46:21 +01:00
Franck Nijhof
60b2cdd069 Allow binary sensor state to be None (#60193) 2021-12-22 12:24:29 +01:00
Ville Skyttä
9b437ef146 Remaining DeviceAutomationType bits (#62508)
* Use DeviceAutomationType in missed tests/components/*

* Tighten device automation type hints
2021-12-21 20:05:48 +02:00
Ville Skyttä
5926961ed5 Use DeviceAutomationType in tests/components/[a-f]* (#62440) 2021-12-20 22:26:29 +01:00
Franck Nijhof
cf371ea8dd Remove deprecated base entity classes (#61006)
* Remove deprecated base entity classes

* Clean up tests
2021-12-05 13:53:52 +01:00
Erik Montnemery
49a27e12ad Add support to entity registry for overriding device_class (#59985) 2021-11-22 08:38:06 -08:00
Erik Montnemery
a989677bef Improve editing of device conditions referencing non-added binary sensor (#51831)
* Improve editing of device conditions referencing non-added binary sensor

* Update tests
2021-06-14 15:26:46 +02:00
Erik Montnemery
d9110b5208 Improve editing of device triggers referencing non-added binary sensors (#51700) 2021-06-10 13:06:01 +02:00
Joakim Sørensen
2f10f59717 Block custom integrations with missing or invalid version (#49916) 2021-05-17 15:48:41 +02:00
Franck Nijhof
5a2b5fe7c5 Yoda assertion style removed is (#48142) 2021-03-20 13:55:10 +01:00
Ville Skyttä
dc880118a4 Lint suppression cleanups (#47248)
* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Aaron Bach
6bf59dbeab Add significant change support to binary_sensor (#45677)
* Add significant change support to binary_sensor
2021-01-30 09:04:35 +01:00
Franck Nijhof
65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00