From be5e495a1cb7ab97b9202900defaf00dbd773054 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Tue, 17 Apr 2018 17:07:43 -0700 Subject: fix unittest test_deploy_try_retrieve_context_does_not_exist unittest is failing due to mock being called multiple times. I assume this is due to parallelization of tests in Jenkins somehow ====================================================================== FAIL: test_deploy_try_retrieve_context_does_not_exist (benchmark.contexts.test_heat.HeatContextTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/tests/unit/benchmark/contexts/test_heat.py", line 309, in test_deploy_try_retrieve_context_does_not_exist mock_path_exists.assert_called_once_with(key_filename) File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 947, in assert_called_once_with raise AssertionError(msg) AssertionError: Expected 'exists' to be called once. Called 3 times. ---------------------------------------------------------------------- Change-Id: I696c63ef9f7943b841e2d3d533c92f18aa7044da Signed-off-by: Ross Brattain --- yardstick/tests/unit/benchmark/contexts/test_heat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yardstick') diff --git a/yardstick/tests/unit/benchmark/contexts/test_heat.py b/yardstick/tests/unit/benchmark/contexts/test_heat.py index 625f97bf4..a40adf5ae 100644 --- a/yardstick/tests/unit/benchmark/contexts/test_heat.py +++ b/yardstick/tests/unit/benchmark/contexts/test_heat.py @@ -306,7 +306,7 @@ class HeatContextTestCase(unittest.TestCase): 'yardstick/resources/files/yardstick_key-', self.test_context._name]) mock_genkeys.assert_called_once_with(key_filename) - mock_path_exists.assert_called_once_with(key_filename) + mock_path_exists.assert_any_call(key_filename) @mock.patch.object(heat, 'HeatTemplate', return_value='heat_template') @mock.patch.object(heat.HeatContext, '_add_resources_to_template') -- cgit 1.2.3-korg