Use TestCase.addCleanup (#36560)
This commit is contained in:
1 parent
85ba29012f
commit
c33edbe5bb
103 files changed
+179
-254
No files matched your search
@@ -14,10 +14,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Set up things to be run when tests are started."""
|
||||
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(self):
|
||||
"""Test sensor setup."""
|
||||
|
||||
@@ -16,8 +16,9 @@ class TestCommandLine(unittest.TestCase):
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
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()
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ class TestCommandSensorSensor(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
|
||||
def tearDown(self):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
self.addCleanup(self.hass.stop)
|
||||
|
||||
def update_side_effect(self, data):
|
||||
"""Side effect function for mocking CommandSensorData.update()."""
|
||||
|
||||
@@ -20,10 +20,7 @@ class TestCommandSwitch(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
|
||||
def tearDown(self):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
self.addCleanup(self.hass.stop)
|
||||
|
||||
def test_state_none(self):
|
||||
"""Test with none state."""
|
||||
|
||||
Reference in new issue
Block a user