1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-27 14:31:13 +00:00

Use TestCase.addCleanup (#36560)

This commit is contained in:
Paulus Schoutsen
2020-06-08 12:26:40 -07:00
committed by GitHub
parent 85ba29012f
commit c33edbe5bb
103 changed files with 179 additions and 254 deletions

View File

@@ -26,10 +26,7 @@ class TestDemoPlatform(unittest.TestCase):
def setUp(self):
"""Initialize values for this testcase class."""
self.hass = get_test_home_assistant()
def tearDown(self):
"""Stop everything that was started."""
self.hass.stop()
self.addCleanup(self.hass.stop)
def test_setup_platform(self):
"""Test setup of demo platform via configuration."""

View File

@@ -32,8 +32,9 @@ class TestNotifyDemo(unittest.TestCase):
self.events.append(event)
self.hass.bus.listen(demo.EVENT_NOTIFY, record_event)
self.addCleanup(self.tear_down_cleanup)
def tearDown(self): # pylint: disable=invalid-name
def tear_down_cleanup(self):
"""Stop down everything that was started."""
self.hass.stop()

View File

@@ -24,8 +24,9 @@ class TestDemoRemote(unittest.TestCase):
)
self.hass.block_till_done()
# pylint: disable=invalid-name
def tearDown(self):
self.addCleanup(self.tear_down_cleanup)
def tear_down_cleanup(self):
"""Stop down everything that was started."""
self.hass.stop()