Commit Graph

429 Commits (b3f7f379df235bcd7ebdd2b039932c98e2dff937)

Author SHA1 Message Date
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
epenet 904cf26d31
Add MockToggleEntity type hints in tests (#120075) 2024-06-21 12:32:03 +02:00
epenet 7af79ba013
Add MockModule type hints in tests (#120007) 2024-06-21 11:11:48 +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 9ad04f9255.
2024-06-21 11:04:15 +02:00
epenet ec9f2f698c
Add type hints to MockGroup and MockUser in tests (#119897) 2024-06-18 13:11:10 -05:00
epenet 38a6e666a7
Add missing return type to some test functions (#119665) 2024-06-14 08:26:45 +02:00
epenet 8e1103050c
Fix dangerous-default-value warnings in core tests (#119568) 2024-06-13 17:10:37 +02:00
epenet ca8d3e0c83
Ignore unnecessary-lambda warnings in tests (#119564) 2024-06-13 16:58:41 +02:00
epenet e3e80c83b7
Fix contextmanager-generator-missing-cleanup warning in tests (#119478) 2024-06-12 22:38:11 +02:00
epenet c70cfbb535
Fix arguments-renamed pylint warning in tests (#119473) 2024-06-12 12:25:29 +02:00
epenet 7388271689
Fix unspecified-encoding warnings in tests (#119405) 2024-06-11 17:58:40 +02:00
epenet 7384140a60
Fix pointless-exception-statement warning in tests (#119402) 2024-06-11 17:20:23 +02:00
Erik Montnemery 8620bef5b0
Support shared keys starting with period in services.yaml (#118789) 2024-06-11 16:31:19 +02:00
epenet ea571a6997
Fix unnecessary-dunder-call pylint warnings in tests (#119379) 2024-06-11 16:18:16 +02:00
epenet 65befcf5d4
Fix import pylint warning in core tests (#119359) 2024-06-11 15:04:00 +02:00
Robert Svensson c9911e4dd4
Rework UniFi tests to not use runtime data (#119202) 2024-06-09 15:56:26 +02:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
J. Nick Koston 475c20d529
Always do thread safety check when writing state (#118886)
* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* async_fire is more common than expected with ccs

* fix mock

* fix hass mocking
2024-06-05 23:41:55 -04:00
Erik Montnemery 35dcda29b9
Use ULID instead of UUID for config entry id and flow ID (#118677) 2024-06-03 10:34:09 +02:00
J. Nick Koston 8f94205014
Include a traceback for non-strict event loop blocking detection (#118620) 2024-06-02 06:36:25 -04:00
J. Nick Koston 25f199c39c
Improve performance of verify_event_loop_thread (#118198) 2024-05-26 17:39:15 -10:00
epenet bb0b01e4a9
Add error message to snapshot_platform helper (#117974) 2024-05-24 10:38:23 +02:00
J. Nick Koston 5a609c34bb
Fix blocking I/O in the event loop when loading timezones (#117721) 2024-05-20 11:06:03 +02:00
Marc Mueller 8f0fb4db3e
Use PEP 695 for class annotations (4) (#117778) 2024-05-20 10:44:52 +02:00
Robert Svensson fa815234be
Make UniFi use runtime data (#117457) 2024-05-14 21:04:26 +02:00
J. Nick Koston 9381462877
Migrate restore_state to use the singleton helper (#117385) 2024-05-14 09:13:44 +09:00
Erik Montnemery d1525b1edf
Sort parameters to MockConfigEntry (#117239) 2024-05-11 14:16:29 -04:00
J. Nick Koston ead69af27c
Avoid creating a task to clear the hass instance at test teardown (#117103) 2024-05-08 23:39:45 +02:00
J. Nick Koston 26cc1cd3db
Use singleton helper for registries (#117027) 2024-05-07 21:04:01 +02:00
J. Nick Koston 164403de20
Add thread safety checks to async_create_task (#116339)
* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* missed one

* Update homeassistant/core.py

* fix mocks

* one more internal

* more places where internal can be used

* more places where internal can be used

* more places where internal can be used

* internal one more place since this is high volume and was already eager_start
2024-04-28 18:29:00 -04:00
Jan Bouwhuis 372c6c7874
Use existing monotonic timestamp on mqtt messages for debugging (#116196) 2024-04-25 19:09:54 -05:00
J. Nick Koston 423544401e
Convert MQTT to use asyncio (#115910) 2024-04-21 22:33:58 +02:00
Joost Lekkerkerker 16e31d8f74
Add test helper to snapshot a platform (#115880)
* Add test helper to snapshot a platform

* Add test helper to snapshot a platform
2024-04-20 14:49:57 +02:00
J. Nick Koston ee535ee611
Ensure test async_create_task eager start behavior matches production (#115517) 2024-04-13 15:58:52 -05:00
J. Nick Koston ca5ed274cb
Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
Marc Mueller a52a80f806
Always include old_state in EventStateChangedData [tests] (#115098) 2024-04-08 08:25:22 -10:00
J. Nick Koston 3daecc7a31
Remove remaining run_immediately=False from tests (#115168) 2024-04-07 16:47:41 -10:00
Sid 8e98ba7312
Add first batch of Ruff PYI rules (#115100)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-07 11:30:50 -10:00
Marc Mueller 8324fd5d1d
Deprecated old backports and typing aliases (#114883) 2024-04-06 13:15:30 -10:00
J. Nick Koston fb98a6f026
Make run_immediately the default for core EventBus listeners (#113752)
* DNM: Make run_immediately the default for listeners

This is a test to see how much progress we have made twords this goal

https://github.com/home-assistant/core/pull/113727#issuecomment-2004587947

* fix shutdown

* Revert "fix shutdown"

This reverts commit a8969d7db9.

* set false since it break utility meter tests

* one more

* fix rfxtrx test

* test needs to be explict now

* fix matrix

* fail sooner
2024-04-05 22:14:20 -04:00
J. Nick Koston aedfd6c983
Add index for floor/label to the area registry (#114777) 2024-04-03 21:04:26 -10:00
J. Nick Koston 3f76d1f056
Add index for area/config_entry/label to the device registry (#114776)
* Add index for area/config_entry/label to the device registry

* use it for services

* naming

* naming

* tweak
2024-04-03 22:52:17 -04:00
Jan-Philipp Benecke 22b14d83e8
Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components` (#114316)
* Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components`

* Missing file

* Fix import

* Remove invalid device class
2024-03-28 12:07:55 +01:00
Marc Mueller 1120745d4e
Update SignalType imports (#114287) 2024-03-27 19:41:11 +01:00
Jan-Philipp Benecke 5c97049f2e
Do not override state property in `MockEntity` (#114231)
Do not override state in `MockEntity`
2024-03-27 11:36:00 +01:00
Jan-Philipp Benecke e80d73783c
Do not late import config_entry in `setup_test_component_platform` test helper (#114260) 2024-03-26 21:54:09 +01:00