Deprecate conf_update_interval (#20924)

* Deprecate update_interval and replace with scan_interval

* Update tests

* Fix Darksky tests

* Fix Darksky tests correctly

This reverts commit a73384a223ba8a93c682042d9351cd5a7a399183.

* Provide the default for the non deprecated option

* Don't override default schema for sensors
This commit is contained in:
Rohan Kapoor authored and Paulus Schoutsen committed 2019-02-16 23:48:37 -08:00
1 parent bc17adda8d
commit 84053103f0
15 files changed
+249 -120

No files matched your search

+17 -1
View File
@@ -713,7 +713,7 @@ def test_deprecated_with_default(caplog, schema):
def test_deprecated_with_replacement_key_and_default(caplog, schema):
"""
Test deprecation behaves correctly when only a replacement key is provided.
Test deprecation with a replacement key and default.
Expected behavior:
- Outputs the appropriate deprecation warning if key is detected
@@ -748,6 +748,22 @@ def test_deprecated_with_replacement_key_and_default(caplog, schema):
assert len(caplog.records) == 0
assert {'venus': True, 'jupiter': False} == output
deprecated_schema_with_default = vol.All(
vol.Schema({
'venus': cv.boolean,
vol.Optional('mars', default=False): cv.boolean,
vol.Optional('jupiter', default=False): cv.boolean
}),
cv.deprecated('mars', replacement_key='jupiter', default=False)
)
test_data = {'mars': True}
output = deprecated_schema_with_default(test_data.copy())
assert len(caplog.records) == 1
assert ("The 'mars' option (with value 'True') is deprecated, "
"please replace it with 'jupiter'") in caplog.text
assert {'jupiter': True} == output
def test_deprecated_with_replacement_key_invalidation_version_default(
caplog, schema, version