summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_service.py')
-rw-r--r--tests/unit/test_service.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py
index c7455e0..824e553 100644
--- a/tests/unit/test_service.py
+++ b/tests/unit/test_service.py
@@ -121,10 +121,11 @@ class ServiceLauncherTest(utils.BaseTestCase):
CONF.unregister_opts(notifier_api.notifier_opts)
# NOTE(markmc): ConfigOpts.log_opt_values() uses CONF.config-file
CONF(args=[], default_config_files=[])
+ self.addCleanup(CONF.reset)
+ self.addCleanup(CONF.register_opts, notifier_api.notifier_opts)
+ self.addCleanup(self._reap_pid)
- def tearDown(self):
- CONF.reset()
- CONF.register_opts(notifier_api.notifier_opts)
+ def _reap_pid(self):
if self.pid:
# Make sure all processes are stopped
os.kill(self.pid, signal.SIGTERM)
@@ -132,8 +133,6 @@ class ServiceLauncherTest(utils.BaseTestCase):
# Make sure we reap our test process
self._reap_test()
- super(ServiceLauncherTest, self).tearDown()
-
def _reap_test(self):
pid, status = os.waitpid(self.pid, 0)
self.pid = None