1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-23 04:19:34 +00:00
Commit Graph

1993 Commits

Author SHA1 Message Date
Joakim Plate
c576a68d33 Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
epenet
987c7a28a9 Add tests for suggested_values in SchemaFlowFormStep (#82906)
* Add tests

* Add test for merging user input
2022-11-29 11:09:12 +01:00
Marc Mueller
63d519c1a8 Spelling updates (#82867) 2022-11-28 16:51:43 +01:00
Erik Montnemery
effa9940ff Save migrated store data (#82523) 2022-11-28 09:42:08 -05:00
Erik Montnemery
e9ce08763c Allow SchemaFlowFormStep.next_step to return None (#82707) 2022-11-25 16:00:26 +01:00
epenet
fd3e996a1e Merge test files (#82703) 2022-11-25 15:11:09 +01:00
epenet
6c615016b8 Fix None schema in SchemaCommonFlowHandler (#82699) 2022-11-25 14:30:02 +01:00
Erik Montnemery
e1338adf1a Allow configuring country and language in core config (#81734)
* Allow configuring country and language in core config

* Add script for updating list of countries

* Use black for formatting

* Fix quoting

* Move country codes to a separate file

* Address review comments

* Add generated/countries.py

* Get default language from owner account

* Remove unused variable

* Add script to generate list of supported languages

* Add tests

* Fix stale docsring

* Use format_python_namespace

* Correct async_user_store

* Improve typing

* Fix with_store decorator

* Initialize language in core store migration

* Fix startup

* Tweak

* Apply suggestions from code review

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Update storage.py

Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-11-24 23:25:50 +01:00
epenet
caa99ea9fb Allow next_step to be a string (#82647)
* Allow next_step to be a string

* Adjust docstrings

* Add test
2022-11-24 18:55:53 +01:00
Erik Montnemery
8577310e6d Fix show_menu support in SchemaFlowFormStep (#82634)
* Fix show_menu support in SchemaFlowFormStep

* Add test

* Fix test
2022-11-24 17:30:01 +01:00
On Freund
9dd1b85cbb Allow device_attr and is_device_attr to be used as a filter and a test (respectively) (#81924)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-11-24 08:31:17 +01:00
epenet
6b85d17e7c Add type hints to template tests (#82566) 2022-11-23 20:28:52 +01:00
epenet
9d192643ee Move PluggableAction to trigger helpers (#81900)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Joakim Plate <elupus@ecce.se>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2022-11-22 11:35:18 +01:00
Erik Montnemery
c3d4a9cd99 Create repairs issue if an outdated currency code is configured (#81717)
* Create repairs issue if an outdated currency code is configured

* Add script for updating list of currencies

* Use black for formatting

* Move currency codes to a separate file

* Address review comments
2022-11-08 07:21:09 +01:00
Petro31
f73fc9e355 Adds states and state_attr as a filter, adds is_state and is_state_attr as a test. (#79473) 2022-10-25 19:49:51 +02:00
Erik Montnemery
aea0067e49 Add additional rules for converting distances (#80940)
* Add additional rules for converting distances

* Convert in to mm

* Adjust existing tests

* Add test
2022-10-25 12:51:23 +02:00
Franck Nijhof
326344db12 Rename entry_id template method to config_entry_id (#80935) 2022-10-25 12:11:14 +02:00
Erik Montnemery
6979cd95b0 Add suggested_unit_of_measurement attribute to sensors (#80638)
* Add suggested_unit_of_measurement attribute to sensors

* Lazy calculation of initial entity options

* Add type alias for entity options

* Small tweak

* Add tests

* Store suggested_unit_of_measurement in its own option key

* Adapt to renaming of IMPERIAL_SYSTEM

* Fix rebase mistakes

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-24 16:08:02 +02:00
epenet
8a1cc05e0c Enforce kwargs in unit system initialisation (#80620)
* Enforce kwargs in unit system initialisation

* Fix tests

* Sort kwargs in unit_system
2022-10-20 10:43:32 +02:00
Erik Montnemery
31a787558f Ensure recorder test fixture is setup before hass fixture (#80528)
* Ensure recorder test fixture is setup before hass fixture

* Adjust more tests
2022-10-19 07:58:47 +02:00
Franck Nijhof
dd266b7119 Remove elevation warning from sun (#80239) 2022-10-14 15:23:44 +02:00
Janick Bergeron
f21a004aa9 Fix before sunrise OR after sunset condition (#76143)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Ben Randall <veleek@gmail.com>
2022-10-14 13:11:10 +02:00
Erik Montnemery
59d9d3de69 Add at_started helper (#79577) 2022-10-05 12:24:51 +02:00
ehendrix23
47b40e1e61 Add optional default value to average template function/filter (#77499)
* Return None on empty list

* Updated to use default value

* Update comment.
2022-10-03 10:07:19 +02:00
ehendrix23
ba6a81c565 Resolve traceback error when using variables in template triggers (#77287)
Co-authored-by: Erik <erik@montnemery.com>
2022-09-29 13:26:28 -04:00
Rami Mosleh
e7764b8bf1 Add ConfigEntry template function (#78030)
* Add ConfigEntry template function

* Remove looking up entry_id by entry title
2022-09-29 12:41:59 +02:00
Erik Montnemery
c38b1e7727 Improve check of new_entity_id in entity_registry.async_update_entity (#78276)
* Improve check of new_entity_id in entity_registry.async_update_entity

* Fix race in rfxtrx config flow

* Make sure Event is created on time

* Rename poorly named variable

* Fix typing

* Correct typing of _handle_state_change
2022-09-28 08:43:58 +02:00
Erik Montnemery
53263ea9bc Revert "Add serial_number to device registry entries" (#79139) 2022-09-27 16:36:38 +02:00
Erik Montnemery
cba3b6ad94 Add serial_number to device registry entries (#77713) 2022-09-27 09:08:54 +02:00
Joakim Sørensen
8dbe293ae2 Add version to templates (#78484) 2022-09-15 15:01:40 +02:00
Erik Montnemery
84a812ad05 Allow setting number selector step size to 'any' (#78265)
* Allow setting number selector step size to 'any'

* Improve test coverage
2022-09-15 08:29:46 +02:00
Erik Montnemery
4e32bf2ac9 Drop old migration code from entity registry (#78278) 2022-09-12 22:28:05 -04:00
Erik Montnemery
e332091d76 Improve unique_id collision checks in entity_platform (#78132) 2022-09-09 14:35:23 +02:00
Erik Montnemery
b0d033ef29 Add mixin class CollectionEntity for the collection helper (#77703)
* Add mixin class CollectionEntity for the collection helper

* Improve typing

* Address review comments

* Fix tests
2022-09-03 12:56:49 +02:00
Erik Montnemery
51c5f1d16a Remove useless device_registry test (#77714) 2022-09-02 20:44:42 +00:00
Erik Montnemery
1bc8770b51 Remove area_id from entity_registry.async_get_or_create (#77700)
* Remove area_id from entity_registry.async_get_or_create

* Adjust tests

* Fix lying comment in test
2022-09-02 13:31:05 +02:00
Erik Montnemery
8924725d69 Improve some device registry tests (#77659) 2022-09-02 08:54:02 +02:00
Erik Montnemery
cd2045b66d Clean up user overridden device class in entity registry (#77662) 2022-09-01 11:45:19 -04: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
Franck Nijhof
dfc3e7d80f Don't expose attribute option in state selector (#77347) 2022-08-26 11:51:36 +02:00
Erik Montnemery
dfed3ba75e Move issue_registry to homeassistant.helpers (#77299)
* Move issue_registry to homeassistant.helpers

* Add backwards compatibility
2022-08-25 11:32:06 +02:00
Franck Nijhof
dc17bca00c Add config entry selector (#77108) 2022-08-24 00:29:30 +02:00
Franck Nijhof
9843753f30 Add alias support to all triggers (#77184) 2022-08-22 17:43:09 -04:00
Franck Nijhof
5a0e4fa5ee Add hide attribute support to attribute selector (#77072)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-08-22 12:55:30 +02:00
Franck Nijhof
453307e01a Add attribute support to state selector (#77071) 2022-08-20 13:30:38 -04:00
Franck Nijhof
2d197fd59e Add state selector (#77024)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-08-19 09:24:53 -04:00
Paulus Schoutsen
6e92931087 Add file selector and file upload integration (#76672) 2022-08-18 12:02:12 -04:00
Franck Nijhof
e65018fb85 Clean up deprecated connection class remainders (#75421) 2022-07-18 21:14:41 -07:00
Franck Nijhof
7adb0f0ef5 Custom component -> Custom integration (#75404) 2022-07-18 22:10:22 +02:00
J. Nick Koston
9a27f1437d Use default encoder when saving storage (#75319) 2022-07-17 14:25:19 +02:00