138 Commits

Author SHA1 Message Date
epenet
377e0a64d1
Reset helpers.frame._REPORTED_INTEGRATIONS in between tests (#139924)
* Reset helpers.frame._REPORTED_INTEGRATIONS in between tests

* Rename

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-03-06 13:57:13 +01:00
Erik Montnemery
c51e644203
Prioritize integration_domain passed to helper.frame.report_usage (#139819)
* Prioritize integration_domain passed to helper.frame.report_usage

* Update tests

* Update tests

* Improve docstring

* Rename according to suggestion
2025-03-06 13:16:50 +01:00
Erik Montnemery
428cc1a951
Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
epenet
7b1b229718
Standardize homeassistant imports in component tests (a-l) (#136806) 2025-01-29 10:00:45 +01:00
epenet
427db02029
Remove deprecated supported features warning in AlarmControlPanel (#132665) 2024-12-09 10:16:48 +01:00
Robert Resch
54ff6feadc
Remove deprecated alarm control panel constants (#131790) 2024-11-28 12:11:08 +01:00
G Johansson
1450fe0880
Improve test quality in alarm_control_panel (#130541) 2024-11-27 17:49:02 +01:00
G Johansson
1e05f98ddd
Use report_usage for deprecation warning in alarm_control_panel (#130543)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-11-27 08:57:32 +01:00
G Johansson
0ac00ef092
Fix legacy _attr_state handling in AlarmControlPanel (#130479) 2024-11-13 10:55:28 +01:00
G Johansson
cdfec7ebb4
Implement new state property for alarm_control_panel which is using an enum (#126283)
* Alarm state from enum

* Fixes

* Set final

* Fix rebase

* Test const

* Fix breaking version

* Fix other for alarm_control_panel

* Fix integrations

* More

* More

* More

* More

* Fix zha

* Replace _attr_state

* Fix alarm_control_panel

* Fix tests

* Fixes

* Mods

* Change some

* More

* More

* More

* Tests

* Last tests

* Return enum

* Fix zha

* Remove not needed check

* Fix wording

* Fix homekit

* Mod prometheus

* Fix mypy

* Fix homekit

* Fix ifttt
2024-10-21 22:54:27 +02:00
epenet
2cd4456762
Add missing hass type hint in component tests (a) (#124059) 2024-08-16 17:07:57 +02:00
Erik Montnemery
2a5cb8da32
Fix copy-paste errors in alarm_control_panel tests (#122755) 2024-07-29 10:57:34 +02:00
Marc Mueller
2f0dd6f704
Import Generator from collections.abc (2) (#120915) 2024-07-01 11:58:49 +02:00
epenet
dc6c1f4e87
Add MockPlatform type hints in tests (#120012)
* Add MockPlatform type hints in tests

* Remove useless code

* Improve

* Revert "Improve"

This reverts commit 9ad04f925514af46a7cd64f94a518fc093da825c.
2024-06-21 11:04:15 +02:00
epenet
abb8c58b87
Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
epenet
b8e57f6174
Use relative imports in tests [a-i] (#119280) 2024-06-10 12:52:34 +02:00
epenet
5166426d0a
Add type hints for service_calls fixture in pylint plugin (#118356) 2024-06-08 16:32:27 +02:00
Marc Mueller
279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
epenet
492b158818
Add return type hints in tests (a-i) (#118939) 2024-06-06 12:17:08 +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
G Johansson
6b7ff2bf44
Add default code to alarm_control_panel (#112540) 2024-05-29 10:46:53 +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
5316b94705
Use setup_test_component_platform helper for alarm_control_panel entity component tests instead of hass.components (#114301) 2024-03-27 14:36:31 +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
32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +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
J. Nick Koston
e6c6327463
Add deprecation warning for alarm_control_panel supported features when using magic numbers (#106619) 2023-12-28 15:04:06 -10:00
Robert Resch
ea28b74fe9
Deprecate deprecated alarm control panel constants (#106058) 2023-12-20 18:41:17 +01:00
Michael
458fcc6372
Add significant Change support for alarm control panel (#106021) 2023-12-19 09:58:02 +01:00
Erik Montnemery
a4487637ef
Use real devices in alarm_control_panel device action tests (#102716) 2023-10-24 23:39:37 +02:00
Erik Montnemery
4d83cffb39
Use real devices in alarm_control_panel device condition tests (#102703) 2023-10-24 23:27:29 +02:00
Erik Montnemery
952f40a181
Use real devices in alarm_control_panel device trigger tests (#102676) 2023-10-24 22:33:08 +02:00
Erik Montnemery
07936884a3
Use entity registry id in alarm_control_panel device conditions (#95250) 2023-06-26 18:26:21 +02:00
Erik Montnemery
89c9e72768
Use entity registry id in alarm_control_panel device actions (#95241) 2023-06-26 16:59:43 +02:00
Erik Montnemery
1d18fdf7bd
Improve alarm_control_panel device trigger tests (#94956) 2023-06-21 11:11:07 +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
4a8adae146
Teach alarm_control_panel device trigger about entity registry ids (#60977)
* Teach alarm_control_panel device trigger about entity registry ids

* Lint code

* Address review comment
2023-06-20 08:27:31 -04: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
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
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
epenet
07a1a0efa9
Add type hints to integration tests (part 1) (#87777) 2023-02-09 16:09:13 +01:00
Franck Nijhof
51a9f65a01
Clean up unnecessary registry mocks from Core tests (#87726) 2023-02-08 13:28:44 -06:00
epenet
2545694d41
Add type hints to integration tests (a) (#87684)
* Add type hints to accuweather tests

* Adjust a** components

* Adjust aiohttp_client

* ClientSessionGenerator/WebSocketGenerator
2023-02-08 12:16:23 +01:00
Franck Nijhof
24fdd588fd
Code styling tweaks to the tests - Part 1 (#86192) 2023-01-20 13:52:46 +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