tmp_file.seek(0)
expected = ('otzL', '234Z')
- with mock.patch('__builtin__.open') as mock_open:
+ with mock.patch('six.moves.builtins.open') as mock_open:
ctx = context.get_admin_context()
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual(expected,
self.assertTrue(mock_open.called)
def test_get_target_chap_auth_negative(self):
- with mock.patch('__builtin__.open') as mock_open:
+ with mock.patch('six.moves.builtins.open') as mock_open:
e = IOError()
e.errno = 123
mock_open.side_effect = e
self.assertRaises(IOError,
self.target._get_target_chap_auth,
ctxt, self.test_vol)
- mock_open.side_effect = StandardError()
- self.assertRaises(StandardError,
+ mock_open.side_effect = ZeroDivisionError()
+ self.assertRaises(ZeroDivisionError,
self.target._get_target_chap_auth,
ctxt, self.test_vol)
'bspath': self.testvol_path}
with open(os.path.join(self.fake_volumes_dir,
self.test_vol.split(':')[1]),
- 'wb') as tmp_file:
+ 'w') as tmp_file:
tmp_file.write(persist_file)
ctxt = context.get_admin_context()
expected = ('otzL', '234Z')
self.test_vol))
def test_get_target_chap_auth_negative(self):
- with mock.patch('__builtin__.open') as mock_open:
+ with mock.patch('six.moves.builtins.open') as mock_open:
e = IOError()
e.errno = 123
mock_open.side_effect = e
self.assertRaises(IOError,
self.target._get_target_chap_auth,
ctxt, self.test_vol)
- mock_open.side_effect = StandardError()
- self.assertRaises(StandardError,
+ mock_open.side_effect = ZeroDivisionError()
+ self.assertRaises(ZeroDivisionError,
self.target._get_target_chap_auth,
ctxt, self.test_vol)
[testenv:py34]
commands =
python -m testtools.run \
+ cinder.tests.unit.targets.test_base_iscsi_driver \
+ cinder.tests.unit.targets.test_cxt_driver \
+ cinder.tests.unit.targets.test_iser_driver \
+ cinder.tests.unit.targets.test_lio_driver \
+ cinder.tests.unit.targets.test_scst_driver \
+ cinder.tests.unit.targets.test_tgt_driver \
cinder.tests.unit.test_api_urlmap \
cinder.tests.unit.test_backup \
cinder.tests.unit.test_backup_ceph \