Merge "Use 'addCleanup' instead of 'tearDown' in engine(s) test"
This commit is contained in:
@@ -1505,14 +1505,15 @@ class WorkerBasedEngineTest(EngineTaskTest,
|
|||||||
self.worker_thread = tu.daemon_thread(self.worker.run)
|
self.worker_thread = tu.daemon_thread(self.worker.run)
|
||||||
self.worker_thread.start()
|
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...
|
# Make sure the worker is started before we can continue...
|
||||||
self.worker.wait()
|
self.worker.wait()
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
self.worker.stop()
|
|
||||||
self.worker_thread.join()
|
|
||||||
super(WorkerBasedEngineTest, self).tearDown()
|
|
||||||
|
|
||||||
def _make_engine(self, flow,
|
def _make_engine(self, flow,
|
||||||
flow_detail=None, store=None, **kwargs):
|
flow_detail=None, store=None, **kwargs):
|
||||||
kwargs.update(self.engine_conf)
|
kwargs.update(self.engine_conf)
|
||||||
|
|||||||
Reference in New Issue
Block a user