core/tests/util
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
..
yaml Fix failure to raise on bad YAML syntax from include files (#75510) 2022-07-20 19:25:17 +02:00
__init__.py
test_aiohttp.py Allow sending webhooks via WS connection (#62725) 2022-01-07 10:41:36 -08:00
test_async.py Custom component -> Custom integration (#75404) 2022-07-18 22:10:22 +02:00
test_color.py Use Kelvin as the preferred color temperature unit (#79591) 2022-10-06 12:22:39 +02:00
test_distance.py Deprecate conversion utilities (#78957) 2022-09-28 19:39:44 +02:00
test_dt.py Significantly reduce clock_gettime syscalls on platforms with broken vdso (#81257) 2022-10-31 09:35:08 -04:00
test_executor.py Fix deadlock at shutdown with python 3.9 (#52613) 2021-07-07 09:23:24 +02:00
test_file.py Use atomicwrites for mission critical core files (#59606) 2021-11-15 11:19:31 +01:00
test_init.py Fix flaky datetime test (#68524) 2022-03-23 09:30:01 +01:00
test_json.py Use default encoder when saving storage (#75319) 2022-07-17 14:25:19 +02:00
test_location.py Upgrade pytest-aiohttp (#82475) 2022-11-29 22:36:36 +01:00
test_logging.py Ensure original log handlers are restored at close (#49230) 2021-04-15 10:53:48 +02:00
test_network.py Add is_host_valid util (#76589) 2022-09-11 11:12:04 -05:00
test_package.py Remove pip --prefix workaround (#74922) 2022-07-11 11:33:28 +02:00
test_percentage.py Handle range conversions that do not start at 1 (#48298) 2021-03-24 12:33:44 -10:00
test_pressure.py Improve precision in pressure conversion (#79362) 2022-10-06 12:48:31 +02:00
test_process.py
test_read_only_dict.py Protect state.as_dict from mutation (#65693) 2022-02-04 14:45:25 -08:00
test_speed.py Deprecate conversion utilities (#78957) 2022-09-28 19:39:44 +02:00
test_temperature.py Deprecate conversion utilities (#78957) 2022-09-28 19:39:44 +02:00
test_thread.py Ensure shutdown does not deadlock (#49282) 2021-04-18 08:55:51 -10:00
test_timeout.py Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
test_ulid.py Use ULID short format for context ids (#71119) 2022-05-01 21:44:54 -07:00
test_unit_conversion.py Use unit enums in unit utilities (#81030) 2022-10-26 20:47:17 +02:00
test_unit_system.py Use unit enums in unit utilities (#81030) 2022-10-26 20:47:17 +02:00
test_uuid.py
test_variance.py Add PrusaLink integration (#77429) 2022-08-29 20:45:27 -04:00
test_volume.py Deprecate conversion utilities (#78957) 2022-09-28 19:39:44 +02:00