summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/functional
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2015-08-19 19:15:35 +0200
committerDmitry Tantsur <dtantsur@redhat.com>2015-08-19 19:15:35 +0200
commit0c183edd71854e9c2f5f6c81312f33a011179235 (patch)
treea5465c151c074ec7610b0c911ab26cf33ca61f7b /ironic_python_agent/tests/functional
parent2d0ba420f1728656cb7f093c82bdf3bc599f0178 (diff)
downloadironic-python-agent-0c183edd71854e9c2f5f6c81312f33a011179235.tar.gz
Use addCleanup instead of tearDown
tearDown is not guaranteed to run if setUp fails Change-Id: I942fd630617276044edfb4b2ed526a269e80f307
Diffstat (limited to 'ironic_python_agent/tests/functional')
-rw-r--r--ironic_python_agent/tests/functional/base.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/ironic_python_agent/tests/functional/base.py b/ironic_python_agent/tests/functional/base.py
index 7e2f5990..930949fa 100644
--- a/ironic_python_agent/tests/functional/base.py
+++ b/ironic_python_agent/tests/functional/base.py
@@ -39,6 +39,7 @@ class FunctionalBase(test_base.BaseTestCase):
self.process = multiprocessing.Process(
target=self.agent.run)
self.process.start()
+ self.addCleanup(self.process.terminate)
# Wait for process to start, otherwise we have a race for tests
tries = 0
@@ -52,7 +53,3 @@ class FunctionalBase(test_base.BaseTestCase):
tries += 1
raise IOError('Agent did not start after %s seconds.' % max_tries)
-
- def tearDown(self):
- super(FunctionalBase, self).tearDown()
- self.process.terminate()