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 2019-02-16 21:23:09 -08:00 committed by Martin Hjelmare
parent ad9ec2190c
commit 481439d387
15 changed files with 249 additions and 120 deletions

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