diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-17 01:58:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-17 01:58:52 +0000 |
commit | 255ae5b1e6e85f118ef42298bfbc8dce1ad1969f (patch) | |
tree | c64b1767e534ba400a8627c6bdf7a3841c746c11 | |
parent | 9c6eba101c7b656d077b95cf5d028551b0460aa1 (diff) | |
parent | 7053020cfd7fc3ed93bdd83ca4b70a2e95818daa (diff) |
Merge "utils: create TASK_LOG_DIR if it doesn't exist"
-rw-r--r-- | tests/unit/benchmark/core/test_task.py | 3 | ||||
-rw-r--r-- | yardstick/benchmark/core/task.py | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py index 25688bf48..14027e43c 100644 --- a/tests/unit/benchmark/core/test_task.py +++ b/tests/unit/benchmark/core/test_task.py @@ -290,8 +290,9 @@ class TaskTestCase(unittest.TestCase): task.change_server_name(scenario, suffix) self.assertTrue(scenario['target']['name'], 'demo-8') + @mock.patch('yardstick.benchmark.core.task.utils') @mock.patch('yardstick.benchmark.core.task.logging') - def test_set_log(self, mock_logging): + def test_set_log(self, mock_logging, mock_utils): task_obj = task.Task() task_obj.task_id = 'task_id' task_obj._set_log() diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index f689f2e63..2c67e736c 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -173,6 +173,7 @@ class Task(object): # pragma: no cover log_format = '%(asctime)s %(name)s %(filename)s:%(lineno)d %(levelname)s %(message)s' log_formatter = logging.Formatter(log_format) + utils.makedirs(constants.TASK_LOG_DIR) log_path = os.path.join(constants.TASK_LOG_DIR, '{}.log'.format(self.task_id)) log_handler = logging.FileHandler(log_path) log_handler.setFormatter(log_formatter) |