1 ##############################################################################
2 # Copyright (c) 2018 Nokia and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 import multiprocessing
15 from yardstick.benchmark.runners import duration
18 class DurationRunnerTest(unittest.TestCase):
21 'runner': {'interval': 0, "duration": 0},
25 @mock.patch.object(os, 'getpid')
26 @mock.patch.object(multiprocessing, 'Process')
27 def test__run_benchmark_called_with(self, mock_multiprocessing_process,
29 mock_os_getpid.return_value = 101
31 runner = duration.DurationRunner({})
32 benchmark_cls = mock.Mock()
33 runner._run_benchmark(benchmark_cls, 'my_method', self.scenario_cfg,
35 mock_multiprocessing_process.assert_called_once_with(
36 name='Duration-some_type-101',
37 target=duration._worker_process,
38 args=(runner.result_queue, benchmark_cls, 'my_method',
39 self.scenario_cfg, {}, runner.aborted, runner.output_queue))