Commit Graph
110 Commits
Author SHA1 Message Date
epenetandGitHub 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
epenetandGitHub abb8c58b87 Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
Marc MuellerandGitHub 33ed4fd862 Import Generator from typing_extensions (3) (#118990) 2024-06-06 17:28:59 +02:00
J. Nick KostonandGitHub 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
epenetandGitHub 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
G JohanssonandGitHub 7862596ef3 Add open state to LockEntity (#111968)
* Add `open` state to LockEntity

* Add tests

* Fixes

* Fix tests

* strings and icons

* Adjust demo open lock

* Fix lock and tests

* fix import

* Fix strings

* mute ruff

* Change sequence

* Sequence2

* Group on states

* Fix ruff

* Fix tests

* Add more test cases

* Sorting
2024-05-08 20:42:22 +02:00
9bf87329da Enable Ruff FLY002 rule (#115112)
Co-authored-by: J. Nick Koston <[email protected]>
Co-authored-by: Jan Bouwhuis <[email protected]>
2024-04-12 09:04:16 +02:00
SidandGitHub 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
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <[email protected]>
2024-03-19 09:01:07 +01:00
Marc MuellerandGitHub 32f3f46542 Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc MuellerandGitHub 1722e23df8 Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
Erik MontnemeryandGitHub c805ea7b4f Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
J. Nick KostonandGitHub 2b972f6dba Add deprecation warning for lock supported features when using magic numbers (#106620) 2023-12-28 15:03:14 -10:00
G JohanssonandGitHub 8cd0644035 Add translation to ServiceValidationError in Lock (#105746) 2023-12-27 12:50:27 +01:00
Robert ReschandGitHub 491a50a2f1 Deprecate deprecated lock constants (#106113) 2023-12-20 18:07:17 +01:00
Jan BouwhuisandGitHub 280637822b Use mocked entity platform for lock service tests (#105020)
* Use mocked entity platform for lock service tests

* Cleanup old mock class

* Follow up on code review

* Improve mock entity platform

* Use entity_id of passed entity instead of constant
2023-12-12 15:49:01 +01:00
Jan BouwhuisandGitHub 7d21ed41a2 Refactor lock default code handling (#104807) 2023-12-04 14:59:51 +01:00
Øyvind Matheson WergelandandGitHub 5527cbd78a Fix default lock code for lock services (#103463)
* verisure: Support default code from lock entity

* Actually use default lock code

* Typing

* Only pass default code if set

* Avoid passing code as empty string

* Simplified code
2023-11-20 22:38:16 +01:00
Jan-Philipp BeneckeandGitHub 0eafc8f2cd Update k-l* tests to use entity & device registry fixtures (#103929) 2023-11-13 20:02:33 +01:00
Erik MontnemeryandGitHub b38692f3a7 Use real devices in lock device condition tests (#102757) 2023-10-25 09:42:00 +02:00
Erik MontnemeryandGitHub f56343f447 Use real devices in lock device action tests (#102723) 2023-10-24 23:43:50 +02:00
Erik MontnemeryandGitHub f9fa1edabf Use real devices in lock device trigger tests (#102690) 2023-10-24 22:30:07 +02:00
Ville SkyttäandGitHub e7b6037419 Remove unnnecessary pylint configs from components [e-l]* (#99004) 2023-08-25 09:46:34 +02:00
Erik MontnemeryandGitHub 320003bf15 Use entity registry id in lock device actions (#95272) 2023-06-26 23:09:26 +02:00
Erik MontnemeryandGitHub 2cfa889750 Use entity registry id in lock device conditions (#95257) 2023-06-26 20:30:05 +02:00
Erik MontnemeryandGitHub e404441e8c Teach lock device trigger about entity registry ids (#94975) 2023-06-21 14:51:09 +02:00
Erik MontnemeryandGitHub fd822bce56 Replace assert_lists_same with pytest_unordered in integrations h-m (#94901) 2023-06-20 20:16:25 +02:00
Jan BouwhuisandGitHub 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 MontnemeryandGitHub 3cca338c6e Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
G JohanssonandGitHub 0bda869553 Lock entity options (#88139) 2023-05-08 22:06:11 +02:00
Franck NijhofandGitHub ed79265843 Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenetandGitHub ea11a30a35 Add type hints to integration tests (part 13) (#87998) 2023-02-13 14:38:37 +01:00
Erik MontnemeryandGitHub cc564026fa Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Franck NijhofandGitHub 51a9f65a01 Clean up unnecessary registry mocks from Core tests (#87726) 2023-02-08 13:28:44 -06:00
epenetandGitHub f75ac17554 Add type hints to integration tests (j-m) (#87704) 2023-02-08 19:06:59 +01:00
epenetandGitHub aa00114c2f Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Jan BouwhuisandGitHub b03677db1c Add validation for lock component (#85842)
* Add validation for lock integration

* Add LockEntityFeature.OPEN for lock group

* Correct tests google_assistant for extra entity

* Validate feature when registering service

* Update tests

* Add LockFeature.OPEN with group
2023-01-23 13:08:00 +01:00
Erik MontnemeryandGitHub 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 MontnemeryandGitHub 150f173eed Mark device conditions from hidden or auxiliary entities as secondary (#70333) 2022-04-20 21:41:59 +02:00
Erik MontnemeryandGitHub 64381acbaf Mark device actions from hidden or auxiliary entities as secondary (#70278) 2022-04-20 10:48:46 -07:00
Franck NijhofandGitHub 721db6d962 Add EntityFeature enum to Lock (#69118) 2022-04-02 20:57:32 -07:00
Franck NijhofandGitHub 8aff8d89d2 Clean up async_reproduce_state helper usage (#68617) 2022-03-24 14:40:54 +01:00
Ville SkyttäandGitHub 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äandGitHub c5e6489475 Use DeviceAutomationType in tests/components/[h-l]* (#62441) 2021-12-20 22:18:53 +01:00
Franck NijhofandGitHub cf371ea8dd Remove deprecated base entity classes (#61006)
* Remove deprecated base entity classes

* Clean up tests
2021-12-05 13:53:52 +01:00
J. Nick KostonandGitHub 9b705ad6df Update lock entity to support locking, unlocking, jammed (#51455) 2021-07-20 18:12:56 +02:00
Erik MontnemeryandGitHub 6ab37881c9 Improve editing of device actions referencing non-added lock (#51750) 2021-06-12 21:31:30 +02:00
Joakim SørensenandGitHub 2f10f59717 Block custom integrations with missing or invalid version (#49916) 2021-05-17 15:48:41 +02:00
9d8521169b Add 'for' to lock device triggers (#48504)
* Add 'for' to lock device triggers

* Update tests/components/lock/test_device_trigger.py

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

* Update test_device_trigger.py

Co-authored-by: Martin Hjelmare <[email protected]>
2021-03-30 16:40:57 +02:00
Ville SkyttäandGitHub 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