Commit graph

221 commits

Author SHA1 Message Date
J. Nick Koston
c41f91be89
Deduplicate entity_id in the states table (#89557) 2023-03-12 10:01:58 -10:00
J. Nick Koston
8bd43760b6
Deduplicate event_types in the events table (#89465)
* Deduplicate event_types in the events table

* Deduplicate event_types in the events table

* more fixes

* adjust

* adjust

* fix product

* fix tests

* adjust

* migrate

* migrate

* migrate

* more test fixes

* more test fixes

* fix

* migration test

* adjust

* speed up

* fix index

* fix more tests

* handle db failure

* preload

* tweak

* adjust

* fix stale docs strings, remove dead code

* refactor

* fix slow tests

* coverage

* self join to resolve query performance

* fix typo

* no need for quiet

* no need to drop index already dropped

* remove index that will never be used

* drop index sooner as we no longer use it

* Revert "remove index that will never be used"

This reverts commit 461aad2c52.

* typo
2023-03-11 14:54:55 -05:00
J. Nick Koston
170a13302c
Reduce overhead to store context ids in the database (#88942) 2023-03-08 14:51:45 -10:00
epenet
c51bde9a26
Fail CI on lingering tasks (#88905) 2023-03-07 11:35:48 +01:00
Jan Bouwhuis
4e66554298
Also set hass.config_entries when mock_hass_config fixture is used (#88669)
* Set `hass.config_entries` with `mock_hass_config`

* Update tests/conftest.py

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

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-28 11:14:04 +01:00
Jan Bouwhuis
b25f6e3ffc
Prepare for refactoring of MQTT related tests (#88557)
* Update mqtt_mock

* Tests manual_mqtt

* Tests mqtt_json

* Tests mqtt_room
2023-02-27 13:54:56 +01:00
Jan Bouwhuis
3afc39dbbf
Set default for hass_config_yaml fixture to "" (#88608)
Set default for hass_config_yaml fixture to ""
2023-02-22 17:18:11 +01:00
Erik Montnemery
356c316b39
Fix stray prints seen inbetween tests (#88570) 2023-02-21 17:19:38 -06:00
Jan Bouwhuis
ebb450c946
Default hass_config to contain an empty config (#88515)
* Default hass_config to {}

* Correct type hint
2023-02-21 08:48:44 +01:00
Jan Bouwhuis
4f6a25b470
Allow parameterizing YAML config in tests (#87981)
* Add fixture to parameterize yaml config

* Apply to more tests

* Re-add @fixture label

* Add fixtures to patch yaml content and targets

* Typo

* Improve docstr

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

* Update references to mock_yaml_configuration

* Apply new fixtures

* Apply to check_config tests

* Follow up comments

* Rename fixtures, update docstr

* Split paths

* Patch load_yaml_config_file instead

* sort

* Fix tests

* improve docst

* Rename fixtures

* sorting

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

* Improve docstr

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

* Improve docstr

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

* Improve docstr

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

* Improve docstr

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

* Improve docstr

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

* Improve docstr

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

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-02-20 16:57:12 +01:00
Erik Montnemery
06213ee595
Drop sqlachemy_utils workaround (#88393) 2023-02-18 09:18:23 -06:00
Franck Nijhof
6891eb7ed1
Add support for snapshot testing (#88323)
* Add support for snapshot testing

* Use snapshots in Elgato diagnostics test

* Use snapshots in Elgato sensor test

* Fix flake8 warning

* Slightly improve serialized output

* Remove snapshot naming in elgato sensor tests

* Improve snapshoting of via_device_id in device registry item

* Update pylint typehints plugin for snapshot fixture typing

* Use snapshots in Elgato configflow test

* Use snapshots in Bluetooth repair issue tests
2023-02-17 16:35:55 -05:00
epenet
a16e298599
Adjust json imports in tests (#88248) 2023-02-17 19:13:48 +01:00
J. Nick Koston
c79157208b
Add python 3.11 to the CI (#88038)
* Remove profiler.memory service

guppy3 is not python3.11 compat
https://github.com/zhuyifei1999/guppy3/issues/41

This service will return if and when guppy3 becomes
python3.11 compat

* squash

* temp remove

* temp dump tests

* temp dump tests

* drop a few more to get a run

* drop a few more to get a run

* Account for changed python3.11 enum.IntFlag behavior in zha

There may be additional changes needed, but I could only
see what needed to be updated based on the tests

* merge

* restore

* restore

* legacy value

* tweak a bit for the python 3.11 timings

* block cchardet

* conditional

* adjust est

* test

* not yet

* tweak

* give a little leeway for timing

* Fix otbr tests

* Increase database test timeout

It looks like we need a little more time to run
with the addiitonal tests in #87019

* Increase database test timeout

It looks like we need a little more time to run
with the addiitonal tests in #87019

* Fix aprs tests with python 3.11

* merge fix

* hints

* Update homeassistant/package_constraints.txt

* Update script/gen_requirements_all.py

* Constrain uamqp for Python 3.10 only

* Bump vulcan-api to 2.3.0

see https://github.com/kapi2289/vulcan-api/pull/126
see https://github.com/home-assistant/core/pull/88038
see https://github.com/home-assistant/docker/pull/260

* add ban

* Bump python-matter-server to 2.1.1

* revert

* Update tests/asyncio_legacy.py

---------

Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
2023-02-16 12:38:32 -05:00
Jan Bouwhuis
950ee34514
Correct typing on hass_storage fixure (#87986)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-13 12:12:34 +01:00
epenet
b7b82b1e3f
Add more type hints to conftest.py (#87842)
* Add more type hints in conftest.py

* Adjust stop_hass

* Adjust mock_integration_frame

* Adjust pylint plugin
2023-02-11 13:48:53 +01:00
epenet
6a1cd75a67
Add MockHAClientWebSocket test helper (#87832)
* Add MockHAClientWebSocket test helper

* Add sample use

* Add missing type hint
2023-02-10 10:23:26 -05:00
epenet
22bfb99db4
Add type hints to requests_mock (#87757) 2023-02-10 11:44:09 +01:00
epenet
fac746c974
Improve recorder type hints in tests (#87826)
* Improve recorder type hints in tests

* Add comment

* Adjust comment
2023-02-10 11:11:39 +01:00
J. Nick Koston
cbaf4764e7
Ensure MySQL tests cleanup connections and raise an exception if they do not (#87767)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Erik <erik@montnemery.com>
2023-02-09 16:27:53 -06:00
Erik Montnemery
2fae82a9ef
Really ensure recorder test fixture is setup before hass fixture (#87796) 2023-02-09 11:43:14 -06:00
J. Nick Koston
c05a7b29e6
Terminate stale MySQL connections at the end of test runs (#87794) 2023-02-09 11:13:13 -06:00
epenet
c946f684bc
Add more type hints to conftest (#87755)
* Add pytest type hints to conftest

* Add bluetooth and integration frame
2023-02-09 09:20:05 +01:00
epenet
aff0174afa
Add more type hints to conftest (#87737) 2023-02-08 22:58:00 +01:00
Franck Nijhof
6551eb168d
Add common area, device, entity and issue registry test fixtures (#87694) 2023-02-08 16:28:44 +01:00
Erik Montnemery
94519de8dd
Upgrade SQLAlchemy to 2.0.2 (#86436)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-08 08:17:32 -06:00
epenet
a4c4f77f73
Add more fixtures to pylint plugin (#87685) 2023-02-08 10:51:09 +01:00
Erik Montnemery
720f51657d
Add CI job which runs recorder tests on PostgreSQL (#80614)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-07 09:46:14 -06:00
Jan Bouwhuis
4ad386d794
Correct type hints mqtt_client_mock and move new generator type (#87527)
* Correct mqtt_client_mock and move MqttMockType

* Rename MqttMockType to MqttMockGenerator

* Make types more specific

* adjust returntype _setup_mqtt_entry

* Correct return type _setup_mqtt_entry

* Update tests/conftest.py

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

* Update tests/conftest.py

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

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-06 15:05:06 +01:00
Jan Bouwhuis
97de0c6d9a
Late review on added type hint MQTT fixture (#87342) 2023-02-03 22:22:52 +01:00
Jan Bouwhuis
3edfd10f2d
Add type hints for MQTT common helper and fixtures (#87065) 2023-02-03 19:27:46 +01:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
epenet
7db166b515
Fix tests typing helper (#86956) 2023-01-31 08:48:35 +01:00
Franck Nijhof
3b5fd4bd06
Enable Ruff TRY004 (#86811) 2023-01-30 14:06:52 +01:00
epenet
7e7a27f8b9
Add type hints to http client fixtures (#86795) 2023-01-30 13:40:07 +01:00
Franck Nijhof
8f74bff354
Enable Ruff PLC0414 (#86799) 2023-01-27 16:32:04 +01:00
Franck Nijhof
ef800335fb
Enable Ruff PT022 (#86792)
* Enable Ruff PT022

* Adjust found cases
2023-01-27 13:57:06 +01:00
Franck Nijhof
bfbf9b9751
Adjusts imports in tests to match our relative import rules (#86788) 2023-01-27 12:51:58 +01:00
epenet
30bf0634fe
Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
Joakim Plate
53b931e21a
Don't interpret negative verbosity as debug (#86318)
* Don't interpret negative verbosity as debug

CI run with -qq which is a negative verbosity

* Make sure all caplog tests get debug level

* Update tests/conftest.py

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

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-01-22 00:03:57 +02:00
Erik Montnemery
d94f007dbf
Import recorder locally in test fixtures (#86286) 2023-01-20 14:22:48 +01:00
Franck Nijhof
24fdd588fd
Code styling tweaks to the tests - Part 1 (#86192) 2023-01-20 13:52:46 +01:00
J. Nick Koston
551e098177
Make event.time_tracker_utcnow patchable with freezegun (#86051) 2023-01-17 09:47:31 +01:00
Ville Skyttä
7eb1b8c2fe
Address a few deprecation warnings in tests (#85472) 2023-01-09 00:52:05 +02:00
J. Nick Koston
d81febd3f4
Small speed up to frequently called datetime functions (#85399) 2023-01-08 09:42:29 -10:00
Erik Montnemery
6490dcf099
Import mqtt and recorder locally in test fixtures (#85067) 2023-01-03 20:18:36 +01:00
Joakim Plate
987e77780a
Only run garbage collection per module (#84681)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2023-01-02 09:31:12 -10:00
Joakim Plate
cb982294bd
Avoid logging increase during tests (#84672) 2022-12-28 22:12:25 +01:00
Joakim Plate
94a02e7613
Switch to orjson for tests (#84674) 2022-12-28 03:36:58 +01:00
J. Nick Koston
9008006ac8
Restore remote discovered devices between remote scanner restarts (#83699) 2022-12-11 09:02:55 -10:00