gate-cinder-python27 gate-cinder-python34 is reporting failures where it
wasn't before. This is all due to new mock version 1.1.0. This patch
fixed the tests to pass the gate.
Some of these errors are actual errors in our test code, while other are
changes to Mock syntax.
Closes-Bug: #
1473454
Change-Id: If8eabfeacacc221e92dfece9f4937875bd70751e
'assert_called_with',
'assert_called_once_with',
'assert_has_calls',
- 'assert_any_calls']
+ 'assert_any_call']
if name.startswith('assert') and name not in valid_asserts:
raise AttributeError('%s is not a valid mock assert method'
0,
self.testvol['id'],
self.testvol['name'])
- mock_execute.assert_any_calls('ietadm',
- '--op',
- 'delete',
- '--tid=1',
- run_as_root=True)
+ mock_execute.assert_any_call('ietadm',
+ '--op',
+ 'delete',
+ '--tid=1',
+ run_as_root=True)
# Test the failure case: putils.ProcessExecutionError
mock_execute.side_effect = putils.ProcessExecutionError
"""
func(*args, **kwargs)
for mock_func in mocks:
- mock_func.side_effect = exception.PureDriverException(
- reason="reason")
+ mock_func.side_effect = [exception.PureDriverException(
+ reason='reason')]
self.assertRaises(exception.PureDriverException,
func, *args, **kwargs)
mock_func.side_effect = None
mock_call(2)
mock_call.assert_has_calls([mock.call(1), mock.call(2)])
- def test_assert_any_calls(self):
+ def test_assert_any_call(self):
mock_call = mock.MagicMock(return_value=None)
mock_call(1)
mock_call(2)
mock_call(3)
- mock_call.assert_any_calls([mock.call(1)])
+ mock_call.assert_any_call(1)
def test_assert_called_with(self):
mock_call = mock.MagicMock(return_value=None)