Use TestCase.addCleanup (#36560)

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

No files matched your search

+3 -5
View File
@@ -71,8 +71,9 @@ class TestPilight(unittest.TestCase):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.skip_teardown_stop = False
self.addCleanup(self.tear_down_cleanup)
def tearDown(self):
def tear_down_cleanup(self):
"""Stop everything that was started."""
if not self.skip_teardown_stop:
self.hass.stop()
@@ -374,10 +375,7 @@ class TestPilightCallrateThrottler(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()
def tearDown(self):
"""Stop everything that was started."""
self.hass.stop()
self.addCleanup(self.hass.stop)
def test_call_rate_delay_throttle_disabled(self):
"""Test that the limiter is a noop if no delay set."""