diff --git a/cinder/tests/unit/policies/test_volume.py b/cinder/tests/unit/policies/test_volume.py index efc99e92673..0aa2266c166 100644 --- a/cinder/tests/unit/policies/test_volume.py +++ b/cinder/tests/unit/policies/test_volume.py @@ -133,7 +133,7 @@ class VolumePolicyTests(test_base.CinderPolicyTests): volume = self._create_fake_volume(admin_context) path = '/v3/%(project_id)s/volumes/detail' % { - 'project_id': admin_context.project_id, 'volume_id': volume.id + 'project_id': admin_context.project_id } response = self._get_request_response(admin_context, path, 'GET') @@ -149,7 +149,7 @@ class VolumePolicyTests(test_base.CinderPolicyTests): volume = self._create_fake_volume(user_context) path = '/v3/%(project_id)s/volumes/detail' % { - 'project_id': user_context.project_id, 'volume_id': volume.id + 'project_id': user_context.project_id } response = self._get_request_response(user_context, path, 'GET') @@ -288,9 +288,9 @@ class VolumePolicyTests(test_base.CinderPolicyTests): # Make sure admins are authorized to show tenant_id in volume detail admin_context = self.admin_context - volume = self._create_fake_volume(admin_context) + self._create_fake_volume(admin_context) path = '/v3/%(project_id)s/volumes/detail' % { - 'project_id': admin_context.project_id, 'volume_id': volume.id + 'project_id': admin_context.project_id } response = self._get_request_response(admin_context, path, 'GET') @@ -305,9 +305,9 @@ class VolumePolicyTests(test_base.CinderPolicyTests): # Make sure owners are authorized to show tenant_id in volume detail user_context = self.user_context - volume = self._create_fake_volume(user_context) + self._create_fake_volume(user_context) path = '/v3/%(project_id)s/volumes/detail' % { - 'project_id': user_context.project_id, 'volume_id': volume.id + 'project_id': user_context.project_id } response = self._get_request_response(user_context, path, 'GET') diff --git a/cinder/tests/unit/targets/test_iet_driver.py b/cinder/tests/unit/targets/test_iet_driver.py index 30a7fd7c3e6..effbb8ad64a 100644 --- a/cinder/tests/unit/targets/test_iet_driver.py +++ b/cinder/tests/unit/targets/test_iet_driver.py @@ -33,16 +33,19 @@ class TestIetAdmDriver(tf.TargetDriverFixture): def test_get_target(self): tmp_file = six.StringIO() tmp_file.write( - 'tid:1 name:iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45\n' # noqa - ' sid:844427031282176 initiator:iqn.1994-05.com.redhat:5a6894679665\n' # noqa + 'tid:1 name:iqn.2010-10.org.openstack:' + 'volume-83c2e877-feed-46be-8435-77884fe55b45\n' + ' sid:844427031282176 initiator:' + 'iqn.1994-05.com.redhat:5a6894679665\n' ' cid:0 ip:10.9.8.7 state:active hd:none dd:none') tmp_file.seek(0) with mock.patch('six.moves.builtins.open') as mock_open: mock_open.return_value = contextlib.closing(tmp_file) self.assertEqual('1', self.target._get_target( - 'iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45' # noqa - )) + 'iqn.2010-10.org.openstack:' + 'volume-83c2e877-feed-46be-8435-77884fe55b45' + )) # Test the failure case: Failed to handle the config file mock_open.side_effect = MemoryError() @@ -153,18 +156,21 @@ class TestIetAdmDriver(tf.TargetDriverFixture): def test_find_sid_cid_for_target(self, mock_delete_target): tmp_file = six.StringIO() tmp_file.write( - 'tid:1 name:iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45\n' # noqa - ' sid:844427031282176 initiator:iqn.1994-05.com.redhat:5a6894679665\n' # noqa + 'tid:1 name:iqn.2010-10.org.openstack:' + 'volume-83c2e877-feed-46be-8435-77884fe55b45\n' + ' sid:844427031282176 initiator:' + 'iqn.1994-05.com.redhat:5a6894679665\n' ' cid:0 ip:10.9.8.7 state:active hd:none dd:none') tmp_file.seek(0) with mock.patch('six.moves.builtins.open') as mock_open: mock_open.return_value = contextlib.closing(tmp_file) self.assertEqual(('844427031282176', '0'), self.target._find_sid_cid_for_target( - '1', - 'iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45', # noqa - 'volume-83c2e877-feed-46be-8435-77884fe55b45' # noqa - )) + '1', + 'iqn.2010-10.org.openstack:' + 'volume-83c2e877-feed-46be-8435-77884fe55b45', + 'volume-83c2e877-feed-46be-8435-77884fe55b45' + )) @mock.patch('cinder.volume.targets.iet.IetAdm._get_target', return_value=1) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py index 574184d22c2..97e679f3194 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py @@ -1699,7 +1699,7 @@ class PowerMaxCommonTest(test.TestCase): clone_name = 'OS-' + clone_volume.id with mock.patch.object( self.common, '_cleanup_target') as mock_cleanup: - self.assertRaises( + self.assertRaises( # noqa: H202 Exception, self.common._create_replica, array, clone_volume, source_device_id, self.data.extra_specs, snap_name) # noqa: ignore=H202 diff --git a/cinder/volume/drivers/dell_emc/unity/client.py b/cinder/volume/drivers/dell_emc/unity/client.py index cb891282975..27a075909b0 100644 --- a/cinder/volume/drivers/dell_emc/unity/client.py +++ b/cinder/volume/drivers/dell_emc/unity/client.py @@ -513,8 +513,8 @@ class UnityClient(object): dst_resource_id=dst_resource_id) except storops_ex.UnityResourceNotFoundError: raise ClientReplicationError( - 'Replication session with name %(name)s not found.'.format( - name=name)) + 'Replication session with name %(name)s not found.' % + {'name': name}) def failover_replication(self, rep_session): """Fails over a replication session. @@ -532,7 +532,7 @@ class UnityClient(object): except storops_ex.UnityException as ex: raise ClientReplicationError( 'Failover of replication: %(name)s failed, ' - 'error: %(err)s'.format(name=name, err=ex) + 'error: %(err)s' % {'name': name, 'err': ex} ) LOG.debug('Replication: %s failed over', name) @@ -552,7 +552,7 @@ class UnityClient(object): except storops_ex.UnityException as ex: raise ClientReplicationError( 'Failback of replication: %(name)s failed, ' - 'error: %(err)s'.format(name=name, err=ex) + 'error: %(err)s' % {'name': name, 'err': ex} ) LOG.debug('Replication: %s failed back', name) diff --git a/test-requirements.txt b/test-requirements.txt index 595ab45dfa3..6ad4607eac4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ # process, which may cause wedges in the gate later. # Install bounded pep8/pyflakes first, then let flake8 install -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=3.1.0,<3.2.0 # Apache-2.0 flake8-import-order # LGPLv3 flake8-logging-format>=0.6.0 # Apache-2.0