Use 'addCleanup' instead of 'tearDown' in engine(s) test

Change-Id: I1d9b13b6f5cd48b7ac98f5c34ef9cb837f9ca7d1
This commit is contained in:
Joshua Harlow
2015-07-17 14:55:49 -07:00
parent a289c7679c
commit 5de13ea44a

View File

@@ -1106,14 +1106,15 @@ class WorkerBasedEngineTest(EngineTaskTest,
self.worker_thread = tu.daemon_thread(self.worker.run)
self.worker_thread.start()
# Ensure worker and thread is stopped when test is done; these are
# called in reverse order, so make sure we signal the stop before
# performing the join (because the reverse won't work).
self.addCleanup(self.worker_thread.join)
self.addCleanup(self.worker.stop)
# Make sure the worker is started before we can continue...
self.worker.wait()
def tearDown(self):
self.worker.stop()
self.worker_thread.join()
super(WorkerBasedEngineTest, self).tearDown()
def _make_engine(self, flow,
flow_detail=None, store=None):
return taskflow.engines.load(flow, flow_detail=flow_detail,