diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-07-17 14:55:49 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-07-17 15:11:03 -0700 |
| commit | 5de13ea44aebee3493cd0cacaff071e465fb7576 (patch) | |
| tree | 3ea1ac850662b0ea8adacc1b553aee4d7d46da38 /taskflow/tests/unit/test_engines.py | |
| parent | a289c7679c86b12580815da2d5fc689d4a857839 (diff) | |
| download | taskflow-5de13ea44aebee3493cd0cacaff071e465fb7576.tar.gz | |
Use 'addCleanup' instead of 'tearDown' in engine(s) test
Change-Id: I1d9b13b6f5cd48b7ac98f5c34ef9cb837f9ca7d1
Diffstat (limited to 'taskflow/tests/unit/test_engines.py')
| -rw-r--r-- | taskflow/tests/unit/test_engines.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/taskflow/tests/unit/test_engines.py b/taskflow/tests/unit/test_engines.py index 0c3ac03..1a68aa7 100644 --- a/taskflow/tests/unit/test_engines.py +++ b/taskflow/tests/unit/test_engines.py @@ -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, |
