J. Nick Koston
9f59515bb8
Fix shutdown deadlock with run_callback_threadsafe ( #45807 )
2021-02-01 10:54:39 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest ( #44746 )
2021-01-01 22:31:56 +01:00
Paulus Schoutsen
479de9433c
Convert core tests to async ( #43287 )
2020-11-16 18:25:55 +01:00
Paulus Schoutsen
819dd27925
Automatically clean up executor as part of closing loop ( #43284 )
2020-11-16 15:43:48 +01:00
J. Nick Koston
2845fca08e
Remove debug prints from utcnow test ( #42977 )
2020-11-08 11:48:01 -06:00
Franck Nijhof
6e9b65405a
Disable legacy templates by default ( #42967 )
2020-11-08 16:11:38 +01:00
J. Nick Koston
1626c236dc
Only call utcnow once during a state changed event ( #42941 )
2020-11-07 15:51:06 -10:00
Paulus Schoutsen
21e9e7c5c2
Default legacy templates to true ( #42511 )
...
* Default legacy templates to true
* Disable legacy_templates in tests
Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-10-28 16:58:16 +01:00
J. Nick Koston
df2ede6522
Fix state overwrite race condition where two platforms request the same entity_id ( #42151 )
...
* Fix state overwrite race condition where two platforms request the same entity id
* fix test
* create reservations instead
* revert
* cannot use __slots__ because we patch async_all
2020-10-21 17:01:51 +02:00
Paulus Schoutsen
b8417a2ce2
Do not allow coroutines to be passed to HassJob ( #42073 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-10-19 23:25:33 +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
J. Nick Koston
4798f37c6e
Convert States to dicts via as_dict only once ( #41208 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-10-05 09:18:57 -05:00
Franck Nijhof
0e6d54ea60
Rewrite core event tests to pytest tests ( #40664 )
2020-09-27 15:39:45 +02:00
J. Nick Koston
35533407fe
Improve performance of counting and iterating states in templates ( #40250 )
...
Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
2020-09-26 11:36:47 -05:00
J. Nick Koston
251d8919ea
Add domain filter support to async_all to match async_entity_ids ( #39725 )
...
This avoids copying all the states before applying
the filter
2020-09-06 23:20:32 +02:00
Paulus Schoutsen
51a63c1fc4
Drop last bits of asyncio.coroutine ( #39280 )
2020-08-26 16:57:52 +02:00
Bas Nijholt
0427d87ba4
Bump codespell from v1.16.0 to v1.17.1 and fix new spelling errors ( #38663 )
2020-08-08 14:41:02 +02:00
Pascal Vizeli
c291d4aa7d
Intelligent timeout handler for setup/bootstrap ( #38329 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-05 14:58:19 +02:00
J. Nick Koston
b3fd8a8343
Fix flapping chained task logging test ( #38492 )
2020-08-03 15:01:15 +02:00
J. Nick Koston
03582402fa
Add debug logging for when a chain of tasks blocks startup ( #38311 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-07-28 18:24:29 +02:00
J. Nick Koston
a7459b3126
Log which task is blocking startup when debug logging is on ( #38134 )
...
* Log which task is blocking startup when debug logging for homeassistant.core is on
* test needs to go one level deeper now
2020-07-23 20:03:42 -06:00
J. Nick Koston
d7811a4adf
Avoid generating a Context() object every second ( #38085 )
...
Every second we were calling the getrandom() syscall to generate a uuid4
for a context that will never be looked:
* In most setups there are no more time_changed listeners
* The ones that do exist never care about context
* time_changed events are never saved in the database
2020-07-22 21:52:10 -07:00
Paulus Schoutsen
8ed1a29c82
Drop white blacklist pt1 ( #37816 )
2020-07-13 17:43:11 +02: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
Aaron Bach
7968cd650a
Add concept of allowed external URLs to config ( #36988 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-06-24 17:37:01 -07:00
Paulus Schoutsen
de12c21ce7
Fire config changed event during start ( #36812 )
2020-06-15 15:22:53 -07:00
J. Nick Koston
578d4a9b6a
Make the frontend available sooner (Part 1 of 2) ( #36263 )
...
* Part 1 of 2 (no breaking changes in part 1).
When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.
This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.
Frontend Changes (home-assistant/frontend#6068 )
* Address review comments
* bump timeout to 1800s, adjust comment
* bump timeout to 4h
* remove timeout failsafe
* and the test
2020-06-02 13:54:11 -05:00
Pascal Vizeli
ed014e3c96
Revert "Ensure frontend is available if integrations fail to start - Part 1 of 2 ( #36093 )" ( #36251 )
...
This reverts commit fbe7b4ddfa
.
2020-05-29 10:18:39 +02:00
J. Nick Koston
fbe7b4ddfa
Ensure frontend is available if integrations fail to start - Part 1 of 2 ( #36093 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-05-28 21:09:07 -07:00
Franck Nijhof
d3ae8a938c
Fix handling of additional data in core config storage ( #35660 )
2020-05-16 13:31:15 +02:00
Franck Nijhof
e56dd8ed50
Detect use of deprecated base_url ( #35353 )
...
* Detect use of deprecated base_url
* Update get_url helper
* Update core migration
* Migrate all tests
2020-05-08 17:52:32 +02:00
Franck Nijhof
2223592486
Add get_url helper, deprecate base_url ( #35224 )
2020-05-08 02:29:47 +02:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 ( #34901 )
2020-04-30 13:29:50 -07:00
Franck Nijhof
98a2efcbab
Collection of random (mainly) test improvements ( #33733 )
2020-04-06 12:51:48 +02:00
Franck Nijhof
03dd92d51b
Use set literals in tests ( #33669 )
2020-04-05 02:20:09 +02:00
Phil Bruckner
bf1b408038
Handle cancellation in ServiceRegistry.async_call ( #33644 )
2020-04-04 15:36:33 -07:00
David F. Mulcahey
bcd1eb952c
RFC - Add a 3rd state to the HA shutdown sequence for writing… ( #33358 )
...
* add third stage to hass shutdown
* use 3rd stage in storage
* update core state
* add writing data to multi stop ignore
* update core test
* review comment
* update name based on feedback
2020-03-30 10:18:39 -07:00
Paulus Schoutsen
07fa844c43
Speed up validate_entity_id ( #32137 )
...
* Speed up validate_entity_id
* Add some more invalid entity IDs
* Adjust regular expression
* Extend and sort test cases
* Update regular expression, more cases, faster
* Adjust tests, allow start with number, disallow double underscore
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-02-24 08:35:02 -08:00
Paulus Schoutsen
beee1298c5
Extend safe mode ( #31927 )
...
* Extend safe mode
* Add safe mode boolean to config JSON output and default Lovelace
* Add safe mode to frontend
* Update accent color
2020-02-18 11:52:38 -08:00
Paulus Schoutsen
12de3f1e47
Clean up frontend services and events ( #31654 )
...
* Clean up frontend services and events
* Fix bug in core instead
* Add test that core works correctly with callback marked async funcs
2020-02-09 19:47:16 -08:00
Ville Skyttä
5e2ba2eb77
Enable some more bandit checks ( #30857 )
...
* Enable B108 (hardcoded tmp dir), address findings
* Enable B602 (subprocess popen with shell), address findings
* Enable B604 (start process with shell), address findings
* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
2020-01-20 18:44:55 +02:00
Ville Skyttä
fa4fa30461
Various string cleanups ( #30435 )
...
* Remove some unnecessary string concatenations
* Replace some simple str.formats with f-strings
* Replace some string concatenations with f-strings
2020-01-03 14:47:06 +01:00
Bas Nijholt
f60125b5c9
Sort imports according to PEP8 for 'tests' ( #29791 )
2019-12-09 16:52:24 +01:00
Pascal Vizeli
c1851a2d94
Cleanup coroutine threadsafe ( #27080 )
...
* Cleanup coroutine threadsafe
* fix lint
* Fix typing
* Fix tests
* Fix black
2019-10-01 16:59:06 +02:00
Paulus Schoutsen
4de97abc3a
Black
2019-07-31 12:25:30 -07:00
Paulus Schoutsen
b90636f640
Update home zone when core config updated ( #24237 )
...
* Update home zone when core config updated
* Lint
2019-05-31 23:03:45 -07:00
Paulus Schoutsen
f995ab9d54
Don't pass in loop ( #23984 )
...
* Don't pass in loop
* Revert some changes
* Lint + Axis revert
* reinstate loop
* Fix a test
* Set loop
* Update camera.py
* Lint
2019-05-22 21:09:59 -07:00
Paulus Schoutsen
9e96397e6a
Require core config detection to be triggerd manually ( #24019 )
...
* Detect core config
* Remove elevation
* Lint
* Lint
* Fix type
2019-05-22 17:24:46 -07:00
Erik Montnemery
afe9fc221e
Fire event when core config is updated ( #23922 )
...
* Fire event when core config is updated
2019-05-20 20:02:36 +02:00
Erik Montnemery
c2fc8a0d61
Load HA core config from storage ( #23872 )
...
* Load HA core config from storage
* Tweak
* Lint, review comments
* Fix test
* Add tests
* Lint
* Address comments
2019-05-16 16:27:53 +02:00
Andrew Sayre
02d8731a61
Add HEOS sign-in/out services ( #23729 )
...
* Add HEOS sign-in/out services
* Fix typo in comment
2019-05-07 09:39:42 -07:00
Jason Hu
f1b867dccb
Re-thrown exception occurred in the blocking service call ( #21573 )
...
* Rethrown exception occurred in the actual service call
* Fix lint and test
2019-03-01 23:09:31 -08:00
Paulus Schoutsen
52f337ef00
Allow chaining contexts ( #21028 )
...
* Allow chaining contexts
* Add stubbed out migration
2019-03-01 10:08:38 -08:00
Paulus Schoutsen
cf3a8b60ff
Prevent invalid context from crashing ( #21231 )
...
* Prevent invalid context from crashing
* Lint
2019-02-20 08:02:56 +01:00
Paulus Schoutsen
d2fea76fd7
Add context to service call event ( #21181 )
2019-02-18 13:07:44 -08:00
Jason Hu
8137b0bb9e
Fix coroutine never awaited warning in test ( #20892 )
2019-02-09 15:13:12 -06:00
Andrew Sayre
e73569c203
Added partial detection to async_add_job ( #20119 )
2019-01-14 15:08:44 -08:00
Paulus Schoutsen
59581786d3
Add raw service data to event ( #19163 )
2018-12-10 12:58:51 +01:00
Paulus Schoutsen
df21dd21f2
RFC: Call services directly ( #18720 )
...
* Call services directly
* Simplify
* Type
* Lint
* Update name
* Fix tests
* Catch exceptions in HTTP view
* Lint
* Handle ServiceNotFound in API endpoints that call services
* Type
* Don't crash recorder on non-JSON serializable objects
2018-11-30 21:28:35 +01:00
Paulus Schoutsen
08fe7c3ece
Pytest tests ( #17750 )
...
* Convert core tests
* Convert component tests to use pytest assert
* Lint 🤷♂️
* Fix test
* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Anders Melchiorsen
0bf10b0b09
Fire an event when timer gets out of sync ( #17398 )
2018-10-15 11:34:36 +02:00
Anders Melchiorsen
3e0c6c176a
Rework timer delays ( #16650 )
...
* Calibrate timer for each tick
* Return of timer out of sync detection
2018-09-17 10:10:50 +02:00
Anders Melchiorsen
e82e75baf3
Improve precision of timer ticks ( #16598 )
2018-09-14 12:28:09 +02:00
Paulus Schoutsen
06af76404f
Fix invalid state ( #16558 )
...
* Fix invalid state
* Make slightly more efficient in unsubscribing
* Use uuid4"
2018-09-11 21:40:35 +02:00
Ville Skyttä
dbd0763f83
Grammar and spelling fixes ( #16065 )
2018-08-19 22:29:08 +02:00
Paulus Schoutsen
9512bb9587
Add and restore context in recorder ( #15859 )
2018-08-10 18:09:01 +02:00
Paulus Schoutsen
c7f4bdafc0
Context ( #15674 )
...
* Add context
* Add context to switch/light services
* Test set_state API
* Lint
* Fix tests
* Do not include context yet in comparison
* Do not pass in loop
* Fix Z-Wave tests
* Add websocket test without user
2018-07-28 17:53:37 -07:00
Andrey
c2fe0d0120
Make typing checks more strict ( #14429 )
...
## Description:
Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)
Add `homeassistant/util/` to checked dirs.
## Checklist:
- [x] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-13 13:24:51 +03:00
Ville Skyttä
234bf1f0ea
Spelling, grammar etc fixes ( #14432 )
...
* Spelling, grammar etc fixes
* s/an api data/data of an api/
2018-05-13 12:09:28 +02:00
Johann Kellerman
507c658fe9
Check whitelisted paths #13107 ( #13154 )
2018-03-29 19:57:19 -07:00
Matthias Urlichs
f5cc40024d
Rename homeassistant.util.async to .async_ ( #13088 )
...
"async" is (going to be) a reserved word.
2018-03-11 10:01:12 -07:00
Johann Kellerman
ff83efe376
is_allowed_path: Also unit test folder #12788 #12807 ( #12810 )
2018-03-01 18:55:58 +01:00
Ville Skyttä
cab6c694c5
Flake8 bugbear fixes ( #12072 )
...
* Don't use mutable argument defaults (bugbear B006)
* Use callable(x) instead of hasattr(x, '__call__') (bugbear B004)
* Remove/mark unused loop control variables (bugbear B007)
* Fix stripping protocol from kodi host name (bugbear B005)
* Fix plant daily history add default date (bugbear B008)
2018-01-30 14:44:05 -08:00
Ville Skyttä
55ee8959ba
Spelling fixes ( #11940 )
2018-01-27 11:58:27 -08:00
Paulus Schoutsen
0d06e8c1c9
Test tweaks ( #11560 )
...
* Fix is_allowed_path on OS X
* Move APNS2 inside func in test
2018-01-10 10:48:17 +01:00
Anders Melchiorsen
8267a21bfe
Lazy loading of service descriptions ( #11479 )
...
* Lazy loading of service descriptions
* Fix tests
* Load YAML in executor
* Return a copy of available services to allow mutations
* Remove lint
* Add zha/services.yaml
* Only cache descriptions for known services
* Remove lint
* Remove description loading during service registration
* Remove description parameter from async_register
* Test async_get_all_descriptions
* Remove lint
* Fix typos from multi-edit
* Remove unused arguments
* Remove unused import os
* Remove unused import os, part 2
* Remove unneeded coroutine decorator
* Only use executor for loading files
* Cleanups suggested in review
* Increase test coverage
* Fix races in existing tests
2018-01-07 14:54:16 -08:00
Paulus Schoutsen
4e8e04fe66
Clean up core ( #10305 )
...
* Clean up core
* Lint
* Fix tests
* Address comment
* Update entity.py
* romve test for forward update to async_update
* fix lint
2017-11-03 14:19:36 +01:00
milanvo
7987065ad7
Fix recorder crash for long state string - enforce at core level ( #9696 )
...
* Recorder exception catch for long state string
* Revert - Recorder exception catch for long state string
* Validate state length at core level
* Revert - this reverts commit 9d6bd017d9
.
* Revert - Recorder exception catch for long state string
* Fix state TypeError
* Test for long state exception
2017-10-25 09:05:30 -07:00
Daniel Høyer Iversen
1892eb654f
Is_allowed_path raise for None path ( #8953 )
...
* is_allowed_path
* Fix #8948
* assert path is not None
* Update test_core.py
* Update test_core.py
* Update test_core.py
2017-08-15 15:41:37 +02:00
Pascal Vizeli
ee7d4710c4
Fix pathlib resolve ( #8311 )
...
* Fix pathlib resolve
* fix test
2017-07-03 07:24:08 +02:00
Pascal Vizeli
2dd7f0616e
Add security layer to send file output things ( #8189 )
...
* Add security layer to send file output things
* Make telegram secure
* fix lint
* fix handling
* invert check
* resolve relative paths
* add test for relative paths
* fix lint
* fix tests
* Address paulus comments
* fix style
* fix tests
* Add more tests
* fix tests
* fix tests
* fix test p2
* fix lint
* fix tests
* Make it available for windows
* Change name / address comments
* fix set
* fix test
* fix tests
* fix test
* fix lint
2017-06-26 00:10:30 +02:00
Pascal Vizeli
b52cabf2c0
Bugfix wait on start event ( #7013 )
...
* Bugfix wait on start event
* Paulus sugestion
* Change handling with stop_track_task
* Add new unittests
* Update test_core.py
2017-04-11 09:09:31 -07:00
Paulus Schoutsen
5d3fe83e62
Warn if start takes a long time. ( #6975 )
...
* Warn if start takes a long time.
* ps - cleanup
* Tweak message
* Add tests
* Tweak messagE
2017-04-08 14:53:32 -07:00
Pascal Vizeli
74ac160355
Bugfix time and task coro ( #6968 )
...
* Bugfix time and task coro
* fix also other create_task
* fix tests
* fix lint in test
2017-04-06 21:00:58 -07:00
Pascal Vizeli
c937a7bcb0
Add support for remove services / Reload script support ( #6441 )
...
* Add support for remove services / Reload script support
* Reload support for scripts
* Add more unittest for services
* Add unittest for script reload
* Address paulus comments
2017-03-07 22:51:34 -08:00
Pascal Vizeli
41849eab06
Core cleanup: two stage shutdown ( #5876 )
...
* Core cleanup: two stage shutdown
* fix spell
* fix
* add async logger to close
* change aiohttp to use CLOSE
* address paulus comments
* Fix tests
* Add unittest
2017-02-13 06:24:07 +01:00
Paulus Schoutsen
6ffab53377
Core: cleanup timer ( #5825 )
...
* Minor core cleanup
* Cleanup timer
* Lint
* timeout with correct loop
* Improve timer thanks to pvizeli
* Update core.py
* More tests
2017-02-10 09:00:17 -08:00
Paulus Schoutsen
c54517de90
Convert config.components to a set ( #5824 )
2017-02-09 20:21:57 +02:00
Pascal Vizeli
3f82ef64a1
Move core service from core to components ( #5787 )
...
* Move core servcie from core to components
* add new handler for signals/exception
* Static persistent id
* Move unittest
* fix coro/callback
* Add more unittest for new services
* Address comments
* Update __init__.py
2017-02-08 09:17:52 -08:00
andrey-git
f774538e66
Check config before restarting ( #5609 )
...
* Check config before restarting.
* Make check_config on restart async
* don't check if notification service exists
* Use .communicate()
* Reduce the number of notifications. Add tests.
2017-02-07 01:19:08 -08:00
Fabian Affolter
2ed0e76e7c
Add elevation to as_dict and use unified style for quoting ( #5448 )
2017-01-19 23:55:29 -08:00
Pascal Vizeli
1d60760e21
Protect add_job ( #4932 )
2016-12-15 21:30:09 -08:00
Paulus Schoutsen
eacdce9ed9
Track tasks only during shutdown and tests ( #4428 )
...
* Track tasks only when needed
* Tweak async_block_till_done
2016-11-24 14:49:29 -08:00
Pascal Vizeli
c8bc1e3c5d
change add_job to use call_soon_threadsafe ( #4410 )
...
* change add_job to use call_soon_threadsafe
* address comments from paulus
* Tweak core tests
* Fix tests Python 3.4.2
2016-11-16 20:00:08 -08:00
Pascal Vizeli
71da21dcc8
Change pending task sheduler to time based cleanup ( #4324 )
...
* Change pending task sheduler to time based cleanup
* update unittest
2016-11-09 08:41:17 -08:00
Pascal Vizeli
8fc853ba11
Add more unittest for async_add_job ( #4320 )
...
* Add more unittest for async_add_job
* fix test
* lint
2016-11-08 20:01:05 -08:00
Pascal Vizeli
114ece1848
Fix possible sigterm / unittest / Fix all lazy test ( #4297 )
...
* replace weakref with a list
* add unittest
* fix lint
* fix handling
* fix unittest
* change code style
* fix lazy tests
2016-11-08 10:24:50 +01:00
Paulus Schoutsen
62785c2431
More async tests ( #4223 )
...
* Annotate test callbacks to be async
* Convert device_sun_light_trigger to be async
2016-11-05 16:36:20 -07:00
Pascal Vizeli
ece58ce78f
Remove ThreadPool with async executor ( #4154 )
...
* Remove ThreadPool with async executor
* Fix zigbee
* update unittest
* fix remote api
* add pending task to remote
* fix lint
* remove unused import
* remove old stuff for lazy tests
* fix bug and add a exception handler to executor
* change executor handling
* change to wait from gather
* fix unittest
2016-11-05 09:27:55 -07:00