Commit graph

29 commits

Author SHA1 Message Date
Erik Montnemery 7fcc2dd44e
Make the check_config script open issue_registry read only (#98545)
* Don't blow up if validators can't access the issue registry

* Make the check_config script open issue_registry read only

* Update tests/helpers/test_issue_registry.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-08-18 20:15:00 +02:00
J. Nick Koston 01e66d6fb2
Improve handling of unrecoverable storage corruption (#96712)
* Improve handling of unrecoverable storage corruption

fixes #96574

If something in storage gets corrupted core can boot loop
or if its integration specific, the integration will fail to
start.

We now complainly loudly in the log, move away the corrupt data
and start fresh to allow startup to proceed so the user can
get to the UI and restore from backup without having to attach
a console (or otherwise login to the OS and manually modify files).

* test for corruption

* ensure OSError is still fatal

* one more case

* create an issue for corrupt storage

* fix key

* persist

* feedback

* feedback

* better to give the full path

* tweaks

* grammar

* add time

* feedback

* adjust

* try to get issue_domain from storage key

* coverage

* tweak wording some more
2023-07-19 09:23:12 +02:00
Ville Skyttä c7c4ee13c3
Import util.dt as dt_util in remaining tests, enforce with ruff (#93765)
* Import `util.dt` as `dt_util` in remaining tests, enforce with ruff

* Fix `util.dt` import in pvpc_hourly_pricing tests
2023-05-30 23:30:31 +03:00
epenet ab4a726e6c
Add tmpdir to known fixtures in pylint (#89844) 2023-03-17 10:22:02 +01:00
epenet 5f25b71df7
Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
epenet c98b4e3204
Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Franck Nijhof 3b5fd4bd06
Enable Ruff TRY004 (#86811) 2023-01-30 14:06:52 +01:00
Erik Montnemery effa9940ff
Save migrated store data (#82523) 2022-11-28 09:42:08 -05:00
J. Nick Koston 9a27f1437d
Use default encoder when saving storage (#75319) 2022-07-17 14:25:19 +02:00
Paulus Schoutsen 689504af86
Raise if trying to store mocks in storage (#63622) 2022-01-09 21:20:21 -08:00
Paulus Schoutsen 442597928e
Store: copy pending data (#59934) 2021-11-18 15:56:22 -08:00
Erik Montnemery d18c250acf
Add minor version support to storage.Store (#59882) 2021-11-18 17:15:40 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
J. Nick Koston 2bbd2a6e70
Reduce complexity of storage writes (#42576)
* Reduce complexity of storage writes

* add test

* stop hass

* workaround bad test
2020-10-29 22:35:51 -05:00
Paulus Schoutsen ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Paulus Schoutsen e7f8d6bbf7
Fix more tests on Python 3.8 (#34703) 2020-04-25 15:52:50 -07:00
David F. Mulcahey 8b0a0ee521
Don't write storage to disk while stopping (#33456)
* Don't write storage to disk while stopping

* rework change

* lint

* remove delay save and schedule final write at stop

* update tests

* fix test component using private methods

* cleanup

* always listen

* use stop in restore state again

* whitelist JSON exceptions for later

* review comment

* make zwave tests use mock storage
2020-04-02 10:25:28 -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
Ville Skyttä 5216477353
Be consistent with Home Assistant and Hass.io spelling (#30500)
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +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
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Adam Mills 5c3a4e3d10 Restore states through a JSON store instead of recorder (#17270)
* Restore states through a JSON store

* Accept entity_id directly in restore state helper

* Keep states stored between runs for a limited time

* Remove warning
2018-11-28 13:16:43 +01:00
Nicko van Someren b0b3620b2b Added working support for private storage (#16903)
* Fixed file corruption bugs in private storage code.

* Restoring fixed test case.

* Implemented test suite for utils/json.py

* Added new unit test cases for util/json.py

* Dixed formatting nags

* Fixed more nags from the Hound

* Added doc strings to some very short functions

* Fixing lint's complains about my choice of parts of speach. Sigh.

* Moved atomic save operations down into util/json.py so that all benefit.

Added extra clean-up code to ensure that temporary files are removed in
case of errors.
Updated emulated_hue unit tests to avoid errors.

* Apparently 'e' is not allows as a variable name for an exception...
2018-10-02 10:16:43 +02:00
Paulus Schoutsen 8ec550d6e0 Storage entity registry (#16018)
* Split out storage delayed write

* Update code using delayed save

* Fix tests

* Fix typing test

* Add callback decorator

* Migrate entity registry to storage helper

* Make double loading protection easier

* Lint

* Fix tests

* Ordered Dict
2018-08-18 13:34:33 +02:00
Paulus Schoutsen 2ad0bd4036
Split out storage delay save (#16017)
* Split out storage delayed write

* Update code using delayed save

* Fix tests

* Fix typing test

* Add callback decorator
2018-08-17 20:18:21 +02:00
Paulus Schoutsen 2205090795
Storage auth (#15192)
* Support parallel loading

* Add storage mock

* Store auth

* Fix tests
2018-06-28 22:14:26 -04:00
Paulus Schoutsen c79c94550f
Return None to indicate no config found (#15147)
* Return None to indicate no config found

* Fix tests
2018-06-25 17:21:38 -04:00
Paulus Schoutsen ae51dc08bf
Add storage helper and migrate config entries (#15045)
* Add storage helper

* Migrate config entries to use the storage helper

* Make sure tests do not do I/O

* Lint

* Add versions to stored data

* Add more instance variables

* Make migrator load config if nothing to migrate

* Address comments
2018-06-25 12:53:49 -04:00