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:
@@ -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."""
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user