1
0
mirror of https://github.com/home-assistant/core.git synced 2025-09-02 09:01:05 +00:00
Commit Graph

346 Commits

Author SHA1 Message Date
Ville Skyttä
24b1e01d71 Update Ruff to 0.1.8, avoid linter/formatter conflicts ()
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Robert Resch
db985925c4 Deprecate deprecated automation constants () 2023-12-19 19:22:13 +01:00
Robert Resch
0e0fd39603 Add dir_with_deprecated_constants function to deprecation helper () 2023-12-19 16:37:21 +01:00
Erik Montnemery
6908497c3d Add minor version to config entries () 2023-12-12 08:44:35 +01:00
Erik Montnemery
1edfaed7be Improve raise contains mocks ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-05 19:14:35 +01:00
Jan Bouwhuis
efd330f182 Send localization info on websocket_api script errors ()
* Send localization info on script errors

* Use connection exception hander

* Keep HomeAssistantError is unknown_error

* Move specific exception handling
2023-11-29 10:47:23 +01:00
Aarni Koskela
706add4a57 Switch formatting from black to ruff-format ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
Jan Bouwhuis
19040becd3 Fix hassio mqtt discovery CI test ()
* Fix hassio mqtt discovery CI test

* Avoid mqtt set up before mocking the flow

* Fix mock
2023-11-24 21:54:53 +01:00
Jan Bouwhuis
af71c2bb45 Raise and suppress stack trace when reloading yaml fails ()
* Allow async_integration_yaml_config to raise

* Docstr - split check

* Implement as wrapper, return dataclass

* Fix setup error handling

* Fix reload test mock

* Move log_messages to error handler

* Remove unreachable code

* Remove config test helper

* Refactor and ensure notifications during setup

* Remove redundat error, adjust tests notifications

* Fix patch

* Apply suggestions from code review

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

* Follow up comments

* Add call_back decorator

* Split long lines

* Update exception abbreviations

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 17:34:45 +01:00
Erik Montnemery
4536fb3541 Remove mock_entity_platform test helper () 2023-11-16 16:55:08 +01:00
Raman Gupta
618b666126 Add support for responses to call_service WS cmd ()
* Add support for responses to call_service WS cmd

* Revert ServiceNotFound removal and add a parameter for return_response

* fix type

* fix tests

* remove exception handling that was added

* Revert unnecessary modifications

* Use kwargs
2023-11-10 21:44:43 +01:00
Joost Lekkerkerker
8b5bfd8cee Add test helper for cloud status updates ()
* Add helper for cloud status updates

* Move import
2023-09-27 17:08:51 +02:00
J. Nick Koston
a03ad87cfb Avoid ConfigEntry lookups in hass.config_entries.async_entries for domain index () 2023-09-20 18:43:15 +02:00
Erik Montnemery
9dac6a2948 Use loop.time in DataUpdateCoordinator () 2023-08-28 10:16:34 -05:00
Marc Mueller
544d6b05a5 Replace mock_coro with AsyncMock ()
* Replace mock_coro with AsyncMock

* Remove mock_coro test helper function

* Remove redundant AsyncMock
2023-08-25 22:54:55 +02:00
Erik Montnemery
3a71e21d6a Add and improve comments about staggering of event listeners () 2023-08-25 19:47:13 +02:00
Ville Skyttä
6399d74c15 Remove unnnecessary pylint configs from core () 2023-08-22 23:12:12 +02:00
Ville Skyttä
2399cd283a Python 3.10 support cleanups () 2023-08-21 19:14:07 +02:00
Erik Montnemery
91faa53843 Don't allow hass.config.config_dir to be None () 2023-08-16 13:00:14 +02:00
Erik Montnemery
3b9d6f2dde Add setup function to the component loader ()
* Add setup function to the component loader

* Update test

* Setup the loader in safe mode and in check_config script
2023-08-15 10:59:42 +02:00
J. Nick Koston
790c1bc251 Decrease event loop latency by binding time.monotonic to loop.time directly ()
* Decrease event loop latency by binding time.monotonic to loop.time directly

This is a small improvment to decrease event loop latency. While the goal is
is to reduce Bluetooth connection time latency, everything using asyncio
is a bit more responsive as a result.

* relo per comments

* fix too fast by adding resolution, ensure monotonic time is patchable by freezegun

* fix test that freezes time too late and has a race loop
2023-08-13 20:37:45 -04:00
Erik Montnemery
045c327928 Move DeviceInfo from entity to device registry ()
* Move DeviceInfo from entity to device registry

* Update integrations
2023-08-10 22:04:26 -04:00
Erik Montnemery
0317afeb17 Fix mock_integration and mock_platform test helpers () 2023-08-09 15:38:57 +02:00
J. Nick Koston
094f2cbad7 Fix saving subclassed datetime objects in storage () 2023-07-31 18:49:02 +02:00
Paulus Schoutsen
5f14cdf69d Allow stopping a script with a response value () 2023-06-27 08:24:22 +02:00
Erik Montnemery
8fda56d2c9 Stable entity registry id when a deleted entity is restored ()
* Stable entity_id and registry id when a deleted entity is restored

* Don't restore area_id

* Don't restore entity_id

* Address review comments
2023-06-26 15:54:35 +02:00
J. Nick Koston
c1045d6c82 Fix hass_storage not clearing task ()
hass_storage would never allow another load if the
no data path was hit

discovered while writing tests for https://github.com/home-assistant/core/pull/95202
2023-06-25 19:54:02 -04:00
Erik Montnemery
732ce34a66 Remove assert_lists_same test helper () 2023-06-21 12:10:28 +02:00
Allen Porter
12129e9d21 Update service call return values and error handling ()
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

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

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00
J. Nick Koston
34b725bb99 Debounce discoveries to improve event loop stability at the started event ()
* Debounce discoveries to improve event loop stability at the started event

The first one is immediate and anything that fires within the next
second will be debounced to only happen once every second

* fix mock
2023-06-15 22:15:07 -04:00
J. Nick Koston
a0c023d5cb Reduce overhead to lookup items in the entity and device registry () 2023-06-14 20:47:18 +02:00
J. Nick Koston
fba826ae9e Migrate restore_state helper to use registry loading pattern ()
* Migrate restore_state helper to use registry loading pattern

As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton

We now use the same pattern as the registry helpers

* fix refactoring error -- guess I am tired

* fixes

* fix tests

* fix more

* fix more

* fix zha tests

* fix zha tests

* comments

* fix error

* add missing coverage

* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
2023-05-30 20:48:17 -05:00
Ville Skyttä
c7c4ee13c3 Import util.dt as dt_util in remaining tests, enforce with ruff ()
* Import `util.dt` as `dt_util` in remaining tests, enforce with ruff

* Fix `util.dt` import in pvpc_hourly_pricing tests
2023-05-30 23:30:31 +03:00
J. Nick Koston
48485fc2bf Complete persistent notifications migration ()
* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
2023-05-25 23:09:13 -04:00
Paulus Schoutsen
6e4c78686e Run pipeline from audio stream function ()
* Run pipeline from audio stream function

* Fix tests

---------

Co-authored-by: Michael Hansen <mike@rhasspy.org>
2023-04-04 00:06:51 -04:00
Erik Montnemery
0ecd043cb2 Add test helper mock_config_flow () 2023-03-22 08:59:35 -04:00
epenet
abd91dd934 Ensure MockEntityPlatform shuts down after tests () 2023-03-17 10:22:43 +01:00
J. Nick Koston
11681f3f31 Pass a helpful name when creating common asyncio tasks in core () 2023-03-05 12:46:02 +01:00
epenet
1bed5c7775 Adjust registry access in tests root () 2023-02-28 21:56:46 -05:00
Erik Montnemery
83e5bf7ae8 Use entity_sources to determine integration in recorder platforms () 2023-02-18 07:21:41 -06:00
epenet
185cd61cbd Add type hints to integration tests (recorder) () 2023-02-17 18:50:09 +01:00
epenet
8c821c8969 Add JSON support to load_fixture ()
* Add JSON support to load_fixture

* More tests

* Remove lru_cache on load_json
2023-02-16 19:40:47 +01:00
Paulus Schoutsen
d54f59478f Keep task references while running ()
* Keep task references while running

* Update pilight tests pointing at correct logger call

* Fix graphite tests

* Fix profiler tests

* More graphite test fixes

* Remove extra sleep

* Fix tests

* Shutdown background tasks as part of stage 1

* Remove unnecessary sleep in test

* Remove unused method on mock hass

* Skip on cancelled too

* Remove background tasks

* Test trigger variables without actually sleeping

* Fix graphite

* One more graphite grrrrrrr
2023-02-13 23:16:59 -05:00
Jan Bouwhuis
950ee34514 Correct typing on hass_storage fixure ()
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-13 12:12:34 +01:00
Paulus Schoutsen
f9dc562251 Stub I/O when loading registries in tests () 2023-02-09 08:25:52 +01:00
Franck Nijhof
6551eb168d Add common area, device, entity and issue registry test fixtures () 2023-02-08 16:28:44 +01:00
Franck Nijhof
20b60d57f2 Add lru cache to loading fixtures in tests () 2023-02-07 16:50:13 +01:00
Jan Bouwhuis
3edfd10f2d Add type hints for MQTT common helper and fixtures () 2023-02-03 19:27:46 +01:00
Franck Nijhof
3b5fd4bd06 Enable Ruff TRY004 () 2023-01-30 14:06:52 +01:00
epenet
30bf0634fe Add per-file-ignore to pylint () 2023-01-22 17:26:24 +01:00