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 arithmetic
18 class ArithmeticRunnerTest(unittest.TestCase):
24 @mock.patch.object(os, 'getpid')
25 @mock.patch.object(multiprocessing, 'Process')
26 def test__run_benchmark_called_with(self, mock_multiprocessing_process,
28 mock_os_getpid.return_value = 101
30 runner = arithmetic.ArithmeticRunner({})
31 benchmark_cls = mock.Mock()
32 runner._run_benchmark(benchmark_cls, 'my_method', self.scenario_cfg,
34 mock_multiprocessing_process.assert_called_once_with(
35 name='Arithmetic-some_type-101',
36 target=arithmetic._worker_process,
37 args=(runner.result_queue, benchmark_cls, 'my_method',
38 self.scenario_cfg, {}, runner.aborted, runner.output_queue))