Commit Graph

474 Commits

Author SHA1 Message Date
Erik Montnemery
510fd09163 Allow core integrations to describe their conditions (#147529)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-07-04 16:03:42 +02:00
Erik Montnemery
1fb587bf03 Allow core integrations to describe their triggers (#147075)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-06-25 17:35:15 +01:00
Paulus Schoutsen
7f99cd2d2b Clean up start_subentry_reconfigure_flow API for tests (#147381) 2025-06-23 21:45:33 +02:00
Robert Resch
88683a318d Add support of taking a camera snapshot via go2rtc (#145205) 2025-06-20 10:34:43 +02:00
Marc Mueller
2c13c70e12 Update ruff to 0.12.0 (#147106) 2025-06-19 20:39:09 +02:00
epenet
8abbd35c54 Add ability to load test fixtures on the executor (#144534) 2025-05-26 21:50:28 +02:00
Abílio Costa
b626204f63 Add default device class display precision for Sensor (#145013)
* Add default device class display precision for Sensor

* Renaming, docstrings, cleanup

* Simplify units list

* Fix tests

* Fix missing precision when suggested is specified

* Update snapshots

* Fix when unit of measurement is not valid

* Fix tests

* Fix deprecated unit usage

* Fix goalzero tests

The sensor native_value method was accessing the data dict and trowing,
since the mock did not have any data for the sensors.

Since now the precision is always specified (it was missing for those
sensors), the throw was hitting async_update_entity_options in _update_suggested_precision.
Previously, async_update_entity_options was not called since it had no
precision.

* Fix metoffice

* Fix smartthings

* Add default sensor data for Tesla Wall Connector tests

* Update snapshots

* Revert spaces

* Update smartthings snapshots

* Add missing sensor mock for tesla wall connector

* Address review comments

* Add doc comment

* Add cap to doc comment

* Update comment

* Update snapshots

* Update comment
2025-05-26 19:40:29 +02:00
Erik Montnemery
4e1d5fbeb0 Add WS command to help reset custom entity_id (#145504)
* Add WS command to help reset custom entity_id

* Calculate suggested object id from entity properties

* Fix logic and add additional tests

* Adjust test

* Update folder_watcher test

* Handle current entity id matches the automatic entity id

* Don't store calculated_object_id

* Update snapshots

* Update snapshots

* Update test

* Tweak logic for reusing current entity_id

* Improve test

* Don't assign same entity_id to several entities

* Prioritize custom entity name

* Update snapshots

* Update snapshots
2025-05-26 19:28:27 +02:00
Joost Lekkerkerker
b5a3cedacd Move to explicit exports in test helpers (#145392) 2025-05-22 10:44:31 +02:00
Simone Chemelli
484a547758 Fix pylance warning on SnapshotAssertion import (#145206) 2025-05-19 13:55:48 +02:00
Erik Montnemery
dc8e1773f1 Remove unused defaults from entity_registry.RegistryEntry (#143655) 2025-04-25 12:41:58 +02:00
epenet
a3605921c9 De-duplicate test helper function (#143437)
* De-duplicate test helper function

* One more
2025-04-22 12:04:12 +02:00
Marc Mueller
a749ecceed Add helper method to clear logger overwrites for tests (#143301) 2025-04-20 09:28:30 +02:00
Marc Mueller
5843e63878 Add contextmanager to reset logger after set_level call in tests (#143295) 2025-04-20 02:13:01 +02:00
Jan-Philipp Benecke
7b9ea63f17 Split out yaml loading into own package (#140683)
* Split out yaml loading into library

* Code review

* Code review

* Fix check config script
2025-03-15 22:26:18 -04:00
Erik Montnemery
af0a862aab Clean up translations for mocked integrations inbetween tests (#138732)
* Clean up translations for mocked integrations inbetween tests

* Adjust code, add test

* Fix docstring

* Improve cleanup, add test

* Fix test
2025-02-19 13:49:31 +01:00
Jan Bouwhuis
d6b7762dd6 Upgrade paho-mqtt API to v2 (#137613)
* Upgrade paho-mqtt API to v2

* Refactor on_connect callback

* Add tests

* Fix Tasmota tests
2025-02-13 22:13:19 +01:00
Erik Montnemery
428cc1a951 Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
Erik Montnemery
4b34d1bbb5 Merge config subentry feature branch to dev (#136121)
* Reapply "Add support for subentries to config entries" (#133470) (#136061)

* Reapply "Add support for subentries to config entries" (#133470)

This reverts commit ecb3bf79f3.

* Update test snapshot

* Add config subentry support to device registry (#128157)

* Add config subentry support to device registry

* Apply suggestions from code review

* Update syrupy serializer

* Update snapshots

* Address review comments

* Allow a device to be connected to no or a single subentry of a config entry

* Update snapshots

* Revert "Allow a device to be connected to no or a single subentry of a config entry"

This reverts commit ec6f613151cb4a806b7961033c004b71b76510c2.

* Update test snapshots

* Bump release version in comments

* Rename config_subentries to config_entries_subentries

* Add config subentry support to entity registry (#128155)

* Add config subentry support to entity registry

* Update syrupy serializer

* Update snapshots

* Update snapshots

* Accept suggested changes

* Clean registries when removing subentry (#136671)

* Clean up registries when removing subentry

* Update tests

* Clean up subentries from deleted devices when removing config entry (#136669)

* Clean up subentries from deleted devices when removing config entry

* Move

* Add config subentry support to entity platform (#128161)

* Add config subentry support to entity platform

* Rename subentry_id to config_subentry_id

* Store subentry type in subentry (#136687)

* Add reconfigure support to config subentries (#133353)

* Add reconfigure support to config subentries

* Update test

* Minor adjustment

* Rename supported_subentry_flows to supported_subentry_types

* Address review comments

* Add subentry support to kitchen sink (#136755)

* Add subentry support to kitchen sink

* Add subentry reconfigure support to kitchen_sink

* Update kitchen_sink tests with subentry type stored in config entry

* Update kitchen_sink

* Update kitchen_sink

* Adjust kitchen sink tests

* Fix hassfest

* Apply suggestions from code review

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

* Improve docstrings and strings.json

---------

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

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-02-10 16:40:07 +01:00
epenet
364556a7dd Prefer from...import...as over import...as in core tests (#136146) 2025-01-21 09:28:17 +01:00
Marc Mueller
46b17b539c Use new syntax for TypeVar defaults (#135780) 2025-01-17 09:12:52 +01:00
Franck Nijhof
60bdc13c94 Drop Python 3.12 support (#135589) 2025-01-14 16:23:15 +01:00
Joost Lekkerkerker
8db63adc11 Bump ruff to 0.9.1 (#135197) 2025-01-14 11:46:12 +01:00
epenet
ee865d2f0f Add exception-translations rule to quality_scale pytest validation (#131914)
* Add exception-translations rule to quality_scale pytest validation

* Adjust

* Return empty dict if file is missing

* Fix

* Improve typing

* Address comments

* Update tests/components/conftest.py

* Update tests/components/conftest.py

* Update tests/components/conftest.py

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2025-01-09 21:21:47 +01:00
Erik Montnemery
ecb3bf79f3 Revert "Add support for subentries to config entries" (#133470)
Revert "Add support for subentries to config entries (#117355)"

This reverts commit ad15786115.
2024-12-18 13:51:05 +01:00
Erik Montnemery
ad15786115 Add support for subentries to config entries (#117355)
* Add support for subentries to config entries

* Improve error handling and test coverage

* Include subentry_id in subentry containers

* Auto-generate subentry_id and add optional unique_id

* Tweak

* Update tests

* Fix stale docstring

* Address review comments

* Typing tweaks

* Add methods to ConfigEntries to add and remove subentry

* Improve ConfigSubentryData typed dict

* Update test snapshots

* Adjust tests

* Fix unique_id logic

* Allow multiple subentries with None unique_id

* Add number of subentries to config entry JSON representation

* Add subentry translation support

* Allow integrations to implement multiple subentry flows

* Update translations schema

* Adjust exception text

* Change subentry flow init step to user

* Prevent creating a subentry with colliding unique_id

* Update tests

* Address review comments

* Remove duplicaetd unique_id collision check

* Remove change from the future

* Improve test coverage

* Add default value for unique_id
2024-12-12 20:16:18 +01:00
Erik Montnemery
bbce183faf Deprecate dt_util.utc_to_timestamp (#131787) 2024-11-28 17:00:20 +01:00
epenet
d6f4a79b46 Remove workaround for flaky translation tests (#131628) 2024-11-27 08:37:36 -06:00
epenet
2bec20ad76 Ensure config entry is added to hass in reauth/reconfigure tests (#129315) 2024-10-28 11:03:42 +01:00
epenet
7d3d693fe8 Align config flow reconfigure step test helper with frontend (#127329)
* Align config flow reconfigure step with frontend

* Update common.py

* Update common.py

* Adjust

* Adjust

* Fix test

* Adjust
2024-10-03 10:21:23 +02:00
epenet
b95dfe2b00 Add test helper for starting reconfiguration flow (#127154) 2024-10-01 12:18:07 +02:00
epenet
86a95013b6 Use start_reauth_flow helper in ezviz and netatmo tests (#127100)
* Use start_reauth_flow helper in netatmo tests

* Use start_reauth_flow helper in ezviz tests
2024-09-30 16:38:34 +02:00
epenet
4bb768f39c Add test for start_reauth_flow test helper (#127093)
* Improve docstring in start_reauth_flow

* Add test

* Make private

* Make fully private until actually needed
2024-09-30 14:28:13 +02:00
Erik Montnemery
d82bff1bc2 Index config entry discovery_keys by discovery domain (#126563)
* Index config entry discovery_keys by discovery domain

* Add new signal

* Update tests

* Update homeassistant/config_entries.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Fix imports

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 21:48:11 +02:00
Erik Montnemery
b2982c18bb Reinitialize zeroconf discovery flow on unignore (#125753)
* Reinitialize zeroconf discovery flow on unignore

* Adjust tests

* Improve comments

* Fix logic for updating discovery keys

* Add tests

* Use mock_config_flow helper in new config_entries test

* Add discovery_keys attribute to ConfigEntry

* Update zeroconf rediscovery

* Change type of ConfigEntry.discovery_keys

* Update tests

* Fix DiscoveryKey.from_json_dict and add tests

* Fix test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 16:49:21 +02:00
epenet
bd2b72235e Use root import in tests (#125862)
* Use root import in components

* One more
2024-09-13 06:42:32 +02:00
epenet
26006f8036 Use start_reauth helper method in broadlink and bthome (#124783)
* Use start_reauth helper method in broadlink reauth tests

* Also include bthome
2024-08-28 16:34:09 +02:00
epenet
14eec2e57a Add start_reauth helper method to MockConfigEntry (#124767)
* Add start_reauth helper method to MockConfigEntry

* Two more
2024-08-28 13:08:26 +02:00
Erik Montnemery
511ec4ba8a Remove test helper get_test_home_assistant (#124177) 2024-08-19 10:23:25 +02:00
Erik Montnemery
ce2ffde22e Update sensor recorder tests to async (#124061) 2024-08-18 13:20:58 -05:00
epenet
ba3872ff87 Add missing hass type in tests/*.py (#124048) 2024-08-18 15:42:41 +02:00
Erik Montnemery
6c01e4b99c Use BaseEventLoop._thread_id instead of a custom attribute (#124054)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-17 10:59:39 +02:00
Erik Montnemery
7deb9bf30f Do not override hass.loop_thread_id in tests (#124053) 2024-08-16 16:59:21 -05:00
Erik Montnemery
115c5d1704 Fix threading in get_test_home_assistant test helper (#124056) 2024-08-16 16:59:33 +02:00
J. Nick Koston
b15ea58851 Relocate code to get scheduled TimerHandles (#123546) 2024-08-12 09:15:33 +02:00
Erik Montnemery
f4125eaf4c Remove loop shutdown indicator when done with test hass (#122432) 2024-07-23 00:56:06 +02:00
Marc Mueller
769d7214a3 Improve tests.common typing (#122257) 2024-07-20 17:34:43 +02:00
Marc Mueller
ca55986057 Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Marc Mueller
fcfb580f0c Update pylint to 3.2.4 (#120606) 2024-06-26 22:29:55 +02:00
Erik Montnemery
e32a27a8ff Remove hass_recorder test fixture (#120295) 2024-06-24 11:14:08 +02:00