Fix tests closing properly (#5203)

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

No files matched your search

@@ -47,6 +47,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
def teardown_method(self, _):
"""Stop everything that was started."""
self.hass.stop()
try:
os.remove(self.hass.config.path(device_tracker.YAML_DEVICES))
except FileNotFoundError:
@@ -210,6 +210,7 @@ class TestAutomatic(unittest.TestCase):
def tearDown(self):
"""Tear down test data."""
self.hass.stop()
@patch('requests.get', side_effect=mocked_requests)
@patch('requests.post', side_effect=mocked_requests)
@@ -43,6 +43,7 @@ class TestDdwrt(unittest.TestCase):
def teardown_method(self, _):
"""Stop everything that was started."""
self.hass.stop()
try:
os.remove(self.hass.config.path(device_tracker.YAML_DEVICES))
except FileNotFoundError:
@@ -24,6 +24,7 @@ class TestComponentsDeviceTrackerMQTT(unittest.TestCase):
def tearDown(self): # pylint: disable=invalid-name
"""Stop everything that was started."""
self.hass.stop()
try:
os.remove(self.hass.config.path(device_tracker.YAML_DEVICES))
except FileNotFoundError:
@@ -691,6 +691,10 @@ class TestDeviceTrackerOwnTrackConfigs(BaseMQTT):
self.hass = get_test_home_assistant()
mock_mqtt_component(self.hass)
def teardown_method(self, method):
"""Tear down resources."""
self.hass.stop()
def mock_cipher(): # pylint: disable=no-method-argument
"""Return a dummy pickle-based cipher."""
def mock_decrypt(ciphertext, key):
@@ -21,6 +21,7 @@ class TestTplink4DeviceScanner(unittest.TestCase):
def tearDown(self): # pylint: disable=invalid-name
"""Stop everything that was started."""
self.hass.stop()
try:
os.remove(self.hass.config.path(device_tracker.YAML_DEVICES))
except FileNotFoundError: