Fix tests closing properly (#5203)

This commit is contained in:
Paulus Schoutsen 2017-01-07 01:47:25 +01:00 committed by GitHub
parent 2b991e2f32
commit aa1e4c564c
14 changed files with 108 additions and 83 deletions

View file

@ -191,15 +191,20 @@ def test_event_schema():
def test_platform_validator():
"""Test platform validation."""
# Prepares loading
get_test_home_assistant()
hass = None
schema = vol.Schema(cv.platform_validator('light'))
try:
hass = get_test_home_assistant()
with pytest.raises(vol.MultipleInvalid):
schema('platform_that_does_not_exist')
schema = vol.Schema(cv.platform_validator('light'))
schema('hue')
with pytest.raises(vol.MultipleInvalid):
schema('platform_that_does_not_exist')
schema('hue')
finally:
if hass is not None:
hass.stop()
def test_icon():