diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-17 16:46:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-07-17 16:46:04 +0000 |
commit | 77ac1aa890964b40aaf12b43301d37575ae753d3 (patch) | |
tree | 6baf8f5a3ccbfbc424594f045cd68d9eede2e84f /tests/unit/benchmark | |
parent | 3a1749fb524ec38e2981c89dc3e032bb6c57719e (diff) | |
parent | 09a7d51cbb23e120176a6cbcbf86968f05764b09 (diff) |
Merge "test_base: speedup unittest, wait for queue not empty"
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r-- | tests/unit/benchmark/runner/test_base.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/unit/benchmark/runner/test_base.py b/tests/unit/benchmark/runner/test_base.py index 6e72fa548..0313ef843 100644 --- a/tests/unit/benchmark/runner/test_base.py +++ b/tests/unit/benchmark/runner/test_base.py @@ -15,12 +15,15 @@ from __future__ import absolute_import import unittest import time +from mock import mock + from yardstick.benchmark.runners.iteration import IterationRunner class RunnerTestCase(unittest.TestCase): - def test_get_output(self): + @mock.patch("yardstick.benchmark.runners.iteration.multiprocessing") + def test_get_output(self, mock_process): runner = IterationRunner({}) runner.output_queue.put({'case': 'opnfv_yardstick_tc002'}) runner.output_queue.put({'criteria': 'PASS'}) @@ -30,7 +33,10 @@ class RunnerTestCase(unittest.TestCase): 'criteria': 'PASS' } - time.sleep(1) + for retries in range(1000): + time.sleep(0.01) + if not runner.output_queue.empty(): + break actual_result = runner.get_output() self.assertEqual(idle_result, actual_result) |