Erik Montnemery
91faa53843
Don't allow hass.config.config_dir to be None ( #98442 )
2023-08-16 13:00:14 +02:00
Erik Montnemery
a77009c3ca
Patch dt_util.utcnow earlier ( #98050 )
2023-08-08 19:16:52 +02:00
Franck Nijhof
b286da211a
Add is_admin check to check configuration API ( #97788 )
2023-08-04 19:25:01 +02:00
Marc Mueller
fe0fe19be9
Use datetime.UTC alias [3.11] ( #97067 )
2023-07-22 17:05:11 -05:00
J. Nick Koston
f36930f165
Fix zeroconf tests with cython 3 ( #97054 )
2023-07-22 12:33:37 -05:00
J. Nick Koston
e9620c62b8
Fix assertions in zeroconf tests ( #96957 )
2023-07-20 20:36:46 +02:00
Jan Bouwhuis
18ee9f4725
Refactor async_get_hass to rely on threading.local instead of a ContextVar ( #96005 )
...
* Test for async_get_hass
* Add Fix
2023-07-07 14:52:38 -04:00
Joakim Plate
067fc079a3
Don't mock non async with AsyncMock ( #93749 )
2023-05-29 20:20:27 +02:00
epenet
98b1005b63
Ensure config entries are unloaded in tests ( #90850 )
2023-04-22 21:26:07 +02:00
epenet
9e1a670e6e
Fail CI on lingering timers (part 2) ( #89976 )
...
* Fail CI on lingering timers (part 2)
* Improve error message
* Adjust tts
2023-04-13 17:03:52 +02:00
epenet
687c035bb2
Make auth test fixtures async ( #91263 )
...
Make auth fixtures async in tests
2023-04-12 20:43:50 -04:00
epenet
d483ad820c
Make hass test fixture async ( #91264 )
2023-04-12 23:55:40 +02:00
Jan Bouwhuis
bb15923968
Rename MQTT entry mock and cleanup ( #91223 )
...
Rename to mqtt_mock_entry and cleanup
2023-04-12 09:43:03 +02:00
Jan Bouwhuis
4a0d3e881a
Rework MQTT config merging and adding defaults ( #90529 )
...
* Cleanup config merging and adding defaults
* Optimize and update tests
* Do not mix entry and yaml config
* Make sure hass.data is initilized
* remove check on get_mqtt_data
* Tweaks to MQTT client
* Remove None assigment mqtt client and fix mock
2023-04-04 18:12:18 +02:00
J. Nick Koston
4ebce9746d
Add schema auto repairs for states tables ( #90083 )
2023-03-22 10:05:23 -10:00
J. Nick Koston
ddcaa9d372
Break out statistics repairs into a `auto_repairs` modules ( #90068 )
...
* Break out statistics schema repairs into a repairs module
A future PR will add repairs for events, states, etc
* reorg
* reorg
* reorg
* reorg
* fixes
* fix patch targets
* name space rename
2023-03-21 21:08:06 -04:00
epenet
9a784fddef
Fail CI on lingering timers ( #89292 )
2023-03-20 10:20:19 +01:00
epenet
9893b1cf4a
Cleanup get_local_ip in global conftest ( #89826 )
2023-03-16 22:03:06 +01:00
epenet
913156b0e0
Avoid lingering timer on script shutdown ( #89753 )
2023-03-16 08:00:21 +01:00
J. Nick Koston
ccab45520b
Remove asyncio.coroutine workarounds ( #88560 )
2023-03-15 20:04:31 -04:00
J. Nick Koston
b9ac6b4a7c
Improve reliability of context id migration ( #89609 )
...
* Split context id migration into states and events tasks
Since events can finish much earlier than states we
would keep looking at the table because states as not
done. Make them seperate tasks
* add retry dec
* fix migration happening twice
* another case
2023-03-12 21:41:48 -04:00
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
Joakim Plate
c196fefe31
Reduce log level for linger task/timer ( #83703 )
...
We don't need to warn that loudly for these issues.
2022-12-10 12:12:56 +01:00
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
Erik Montnemery
f869ce9d06
Validate common statistics DB schema errors on start ( #79707 )
...
* Validate common statistics db schema errors on start
* Fix test
* Add tests
* Adjust tests
* Disable statistics schema validation in tests
* Update after rebase
2022-11-29 10:16:08 +01:00
J. Nick Koston
d6e287f47a
Add manufacturer and model to bluetooth adapter device ( #82769 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-11-27 15:44:44 -05:00
J. Nick Koston
47c66dbed4
Offload platform specific bluetooth code to bluetooth-adapters ( #82196 )
...
* Offload platform specific bluetooth code to bluetooth-adapters
* adjust
* fix some more patch targets
* more test fixes
* almost there
* may not be setup yet
* more fixes
* fixes
* fix test
* fix merge
2022-11-17 14:34:19 -05:00
Erik Montnemery
f4951a4f31
Add CI job which runs recorder tests on MariaDB ( #80586 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-10-19 13:04:28 +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
Erik Montnemery
416aad32cc
Don't mock out migration in recorder tests ( #80480 )
2022-10-17 22:17:08 +02:00
Erik Montnemery
4fcd0f3e23
Fix recorder fixtures ( #79147 )
2022-09-27 17:00:06 +02:00
Erik Montnemery
e66f28f3f7
Teach sqlite3 about HAFakeDatetime ( #78756 )
2022-09-19 23:09:50 +02:00
J. Nick Koston
18eef5da1f
Restore history from bluetooth stack at startup ( #78612 )
2022-09-17 16:58:19 -05:00
Jan Bouwhuis
7fc294d9b1
Set cv hass in hass fixture ( #77271 )
...
* Set cv hass in hass fixture
* Move test_hass_cv and update docstring
* Update tests/test_test_fixtures.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-08-25 12:29:31 +02:00
J. Nick Koston
f6a03625ba
Implement websocket message coalescing ( #77238 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-08-24 22:50:48 -05:00
J. Nick Koston
cd59d3ab81
Add support for multiple Bluetooth adapters ( #76963 )
2022-08-18 21:41:07 -04:00
J. Nick Koston
3bcc274dfa
Rework bluetooth to support scans from multiple sources ( #76900 )
2022-08-17 10:51:56 -10:00
J. Nick Koston
6f3cdb6db1
Reorganize bluetooth integration to prepare for remote and multi-adapter support ( #76883 )
2022-08-16 14:52:53 -10:00
J. Nick Koston
a813cf987b
Add bluetooth options flow to pick the adapter ( #75701 )
2022-07-25 16:52:35 +02:00
J. Nick Koston
38bccadaa6
Add support for setting up and removing bluetooth in the UI ( #75600 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-07-22 13:19:53 -05:00
Erik Montnemery
fd6ffef52f
Support non-live database migration ( #72433 )
...
* Support non-live database migration
* Tweak startup order, add test
* Address review comments
* Fix typo
* Clarify comment about promoting dependencies
* Tweak
* Fix merge mistake
* Fix some tests
* Fix additional test
* Fix additional test
* Adjust tests
* Improve test coverage
2022-07-22 15:11:34 +02:00
Erik Montnemery
9d0a252ca7
Improve handling of MQTT config entry data ( #72691 )
...
* Improve handling of MQTT config entry data
* Add test
* Add warning
* Adjust tests
2022-07-22 13:36:43 +02:00
J. Nick Koston
a3c1926da5
Add mock_bluetooth fixture ( #75075 )
2022-07-14 07:40:17 -05:00
J. Nick Koston
08ff1b8986
Fix flapping system log test ( #75111 )
2022-07-14 11:05:52 +02:00
Jan Bouwhuis
52561ce076
Update MQTT tests to use the config entry setup ( #72373 )
...
* New testframework and tests for fan platform
* Merge test_common_new to test_common
* Add alarm_control_panel
* Add binary_sensor
* Add button
* Add camera
* Add climate
* Add config_flow
* Add cover
* Add device_tracker_disovery
* Add device_trigger
* Add diagnostics
* Add discovery
* Add humidifier
* Add init
* Add lecacy_vacuum
* Add light_json
* Add light_template
* Add light
* Add lock
* Add number
* Add scene
* Add select
* Add sensor
* Add siren
* Add state_vacuum
* Add subscription
* Add switch
* Add tag
* Add trigger
* Add missed tests
* Add another missed test
* Add device_tracker
* Remove commented out code
* Correct tests according comments
* Improve mqtt_mock_entry and recover tests
* Split fixtures with and without yaml setup
* Update fixtures manual_mqtt
* Update fixtures mqtt_json
* Fix test tasmota
* Update fixture mqtt_room
* Revert fixture changes, improve test
* re-add test
2022-06-02 14:24:46 +02:00
Jan Bouwhuis
ed1c2ea2b8
Move manual configuration of MQTT fan and light to the integration key ( #71676 )
...
* Processing yaml config through entry setup
* Setup all platforms
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* adjust mock_mqtt - reference config from cache
* Fix test config entry override
* Add tests yaml setup
* additional tests
* Introduce PLATFORM_SCHEMA_MODERN
* recover temporary MQTT_BASE_PLATFORM_SCHEMA
* Allow extra key in light base schema, restore test
* Fix test for exception on platform key
* One deprecation message per platform
* Remove deprecation checks from modern schema
* Update homeassistant/components/mqtt/fan.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/fan.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/schema_json.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/light/schema_template.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* rename validate_modern_schema
* Do not fail platform if a single config is broken
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix tests on asserting log
* Update log. Make helper transparant, remove patch
* Perform parallel processing
* Update tests/components/mqtt/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* black
* Fix tests and add #new_format anchor
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-19 15:04:53 +02:00
J. Nick Koston
222baa53dd
Make database access in the eventloop raise an exception ( #71547 )
2022-05-09 15:22:08 -05:00
Erik Montnemery
f96c1136b0
Bump pytest-socket to 0.5.1 ( #69624 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-04-26 10:42:37 -10:00
Erik Montnemery
3016b5fbfc
Use recorder fixtures and helpers in tests ( #70773 )
2022-04-26 06:08:00 -10:00
Erik Montnemery
28ebab9c5a
Simplify waiting for recorder in tests ( #70647 )
2022-04-25 12:04:47 +02:00
Erik Montnemery
982e314de6
Use recorder_mock in tests ( #70363 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-22 19:29:44 -10:00
J. Nick Koston
23de8d4156
Revert changes to test/conftest.py from #70300 ( #70385 )
2022-04-21 10:49:47 -10:00
J. Nick Koston
309424d3b9
Prevent tests changing units from affecting other tests ( #70300 )
...
* Prevent tests changing temperature_unit from affecting other tests
* tweak
2022-04-19 11:38:52 -10:00
J. Nick Koston
fe6a4bfb1d
Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC ( #69643 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
Erik Montnemery
7e8d52e5a3
Fix race when handling rapid succession of MQTT discovery messages ( #68785 )
...
Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-03-29 20:26:11 -07:00
Marc Mueller
c9cc2eb7c8
Fix flaky datetime test ( #68524 )
2022-03-23 09:30:01 +01:00
Erik Montnemery
247af2e74f
Improve recorder setup in tests ( #68333 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-03-21 15:49:18 -07:00
Erik Montnemery
cf4033b1bc
Simplify time zone setting in tests ( #68330 )
...
* Simplify timezone setting in tests
* Fix typo
* Adjust caldav tests
* Adjust input_datetime tests
* Adjust time_date tests
* Adjust tod tests
* Adjust helper tests
* Adjust recorder tests
* Adjust risco tests
* Adjust aemet tests
* Adjust flux tests
* Adjust forecast_solar tests
* Revert unnecessary change in forecast_solar test
* Adjust climacell tests
* Adjust google tests
* Adjust sensor tests
* Adjust sonarr tests
* Adjust template tests
* Adjust zodiac tests
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
Erik Montnemery
d360ac91ca
Disable recorder nightly jobs in tests ( #68188 )
2022-03-15 09:23:52 -07:00
Erik Montnemery
98982c86e4
Add MQTT diagnostics ( #66730 )
...
* Add MQTT diagnostics
* Redact device tracker location
* Adjust tests
* Address comments from code review
2022-02-18 09:28:49 +01:00
Erik Montnemery
fe38e6ba87
Drop MQTT import flow ( #66160 )
...
* Drop MQTT import flow
* Reload manually configured MQTT entities when config entry is setup
* Address review comments
* Actually remove the import flow
2022-02-10 21:09:57 +01:00
Paulus Schoutsen
63f8e437ed
Add Home Assistant Content user ( #64337 )
2022-01-21 10:06:39 -08:00
Stefan Agner
a13ae85982
Introduce only_supervisor for @websocket_api.ws_require_user() ( #61298 )
2021-12-08 16:49:35 -08:00
epenet
c05eca1c82
Remove log flooding prevention logic from discovery info ( #61243 )
...
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-08 10:28:26 -10:00
J. Nick Koston
347c4ea137
Bump zeroconf to 0.37.0 ( #59932 )
2021-11-18 20:23:20 -08:00
Simone Chemelli
5fc51130ea
Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 4 ( #58669 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-11-15 09:18:57 -08:00
Erik Montnemery
30f7bc0f18
Use freezegun in DST tests ( #58939 )
2021-11-02 18:11:39 +01:00
Paulus Schoutsen
f51e1fcb67
Check for uncaught service not found exceptions ( #58010 )
2021-11-01 14:33:09 +01:00
Erik Montnemery
f6682ba99d
Block tests from opening sockets ( #55516 )
2021-10-05 14:46:09 -10:00
Erik Montnemery
8c5efafdd8
Add 5-minute statistics for sensors ( #56006 )
...
* Add 5-minute statistics for sensors
* Address pylint issues
* Black
* Apply suggestion from code review
* Apply suggestions from code review
* Improve tests
2021-09-16 10:57:15 +02:00
Erik Montnemery
7dbe8070f7
Mock out network.util.async_get_source_ip in tests ( #55592 )
2021-09-02 20:44:50 +02:00
Erik Montnemery
cdaba62d2c
Add test fixture for unauthenticated HTTP client ( #55561 )
...
* Add test fixture for unauthenticated HTTP client
* Remove things from the future
2021-09-02 13:09:16 +02:00
Erik Montnemery
7dbd0e5274
Fix zeroconf mock and use it in CI group 1's tests ( #55526 )
...
* Fix zeroconf mock and use it in CI group 1's tests
* Mock HaAsyncServiceBrowser
2021-09-01 22:38:00 +02:00
Erik Montnemery
e541bcd54d
Update statistics meta data on entity_id change ( #52755 )
2021-07-14 13:23:11 +02:00
Erik Montnemery
e16a8063a5
Compile statistics for energy sensors ( #50829 )
...
* Compile statistics for energy sensors
* Update tests
* Rename abs_value to state
* Tweak
* Recreate statistics table
* Pylint
* Try to fix test
* Fix statistics for multiple energy sensors
* Fix energy statistics when last_reset is not set
2021-05-20 13:05:15 +02:00
J. Nick Koston
909a20b36d
Use async zeroconf registration functions ( #50168 )
2021-05-11 11:03:36 -05:00
Erik Montnemery
ed31cc363b
Wait for registries to load at startup ( #46265 )
...
* Wait for registries to load at startup
* Don't decorate new functions with @bind_hass
* Fix typing errors in zwave_js
* Load registries in async_test_home_assistant
* Tweak
* Typo
* Tweak
* Explicitly silence mypy errors
* Fix tests
* Fix more tests
* Fix test
* Improve docstring
* Wait for registries to load
2021-02-11 17:36:19 +01:00
Joakim Plate
d4f186078c
During tests we can run with lowest rounds ( #45710 )
2021-01-29 19:57:14 +01:00
Joakim Plate
af68d5fb41
Use a fully mocked credential ( #45707 )
2021-01-29 17:58:25 +01:00
Joakim Plate
38d2cacf7a
Support blocking trusted network from new ip ( #44630 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-28 12:06:20 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest ( #44746 )
2021-01-01 22:31:56 +01:00
Erik Montnemery
5e6f5fca90
Don't send MQTT birth message in tests ( #43917 )
2020-12-04 04:39:49 +01:00
Paulus Schoutsen
ea55051161
Stub finding custom integrations in tests ( #43692 )
2020-11-27 12:53:16 +01:00
Paulus Schoutsen
f9fa24950b
OAuth2 to use current request header ( #43668 )
2020-11-27 08:55:34 +01:00
Tom Parker-Shemilt
2b151209b2
Don't try and store exceptions when the key is missing ( #41803 )
2020-10-16 10:01:58 +02:00
Erik Montnemery
392d5c673a
Cache matching MQTT subscriptions ( #41433 )
2020-10-08 08:52:23 +02:00
J. Nick Koston
9e1461da62
Determine how to run listeners at setup time instead of execution time ( #41304 )
2020-10-07 16:51:50 +02:00
Erik Montnemery
06e9489fc7
Add Tasmota integration ( #39624 )
...
* Add Tasmota integration
* Refactor
* Add tests, small improvements
* isort
* Attempt to fix tests failing with Python 3.8
* Revert "Attempt to fix tests failing with Python 3.8"
This reverts commit 11454f8a00136f068ea27204183fa3e62f3cd263.
* Fix tests failing with Python 3.8
* Cleanup tests
* Address review comments
* Address review comments
* Address review comments
* Use MAC address for device identification
* Bump hatasmota
* Bump hatasmota
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Fix indentation
* Remove preparation for device remove WS API
* Address review comments
* Remove useless try-except
* Tweak
* Improve tests
* Tweak
* Address review comments
* Correct test
* Update manifest.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-06 14:51:58 +02:00
J. Nick Koston
7b016063ca
Refactor zeroconf setup to be async ( #39955 )
...
* Refactor zeroconf setup to be async
Most of the setup was calling back to async because
we were setting up listeners. Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.
In testing this cut the setup time in half
or better.
* partial revert to after_deps
2020-09-13 18:06:19 -05:00
Erik Montnemery
ee043d8614
Wait for broker to ACK MQTT operations ( #39051 )
...
* Wait for broker to ACK MQTT operations
* Deduplicate new code
* Fix tests
* Improve test
* Don't hold PAHO lock when waiting for ACK
* Fix tests
* Add constant for ACK timeout
2020-08-21 17:00:13 +02:00
Franck Nijhof
755761867d
Use current request context in OAuth redirect ( #38692 )
2020-08-15 15:26:54 +02:00
J. Nick Koston
60009ec2f9
Use event loop scheduling for tracking time patterns ( #38021 )
...
* Use event loop scheduling for tracking time patterns
* make patching of time targetable
* patch time tests since time can tick to match during the test
* fix more tests
* time can only move forward
* time can only move forward
* back to 100% coverage
* simplify since the event loop time cannot move backwards
* simplify some more
* revert simplify
* Revert "revert simplify"
This reverts commit bd42f232f6
.
* Revert "simplify some more"
This reverts commit 2a6c57d514
.
* Revert "simplify since the event loop time cannot move backwards"
This reverts commit 3b13714ef4
.
* Attempt another simplify
* time does not move backwards in the last two
* remove next_time <= now check
* fix previous merge error
2020-07-20 20:18:31 -10:00
Joakim Plate
bcd604eec2
Detect lingering threads after tests ( #37270 )
...
* Detect lingering threads after tests
* Make sure cast is setup before checking state
* Make sure we ask executors of old hass to shutdown
We are not waiting here, just hoping for the best
* Make sure all instances of hass and executors is stopped.
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Also apply hass stopping to scripts
* Adjust to changes how we set up executor
* Add new CoreState.stopped
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-07-09 16:15:14 +02:00
Paulus Schoutsen
f49ce5d1b4
Protect loop set default executor ( #37438 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-06 15:58:53 -07:00
J. Nick Koston
89a9634d35
Use eventloop for scheduling ( #37184 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07:00
Erik Montnemery
747490ab34
Support reconfiguring MQTT config entry ( #36537 )
2020-06-22 17:49:01 -07:00
Erik Montnemery
280f49540e
Drop use of async_mock_mqtt_component ( #37011 )
2020-06-22 23:59:50 +02:00
Erik Montnemery
f1ecac92df
Fail tests if wrapped callbacks or coroutines throw ( #35010 )
2020-05-06 14:14:57 -07:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 ( #34901 )
2020-04-30 13:29:50 -07:00
Paulus Schoutsen
0d700f6a63
Fix tests for Python 3.8 ( #34672 )
2020-04-25 14:32:55 -07:00
Ziv
1259979204
Fix uncaught exception in local_file ( #34312 )
...
* remove ignore from localfile
* added mock_registry
* since there are no more exceptions, infra to ignore them is redundant
2020-04-17 13:10:48 +02:00