Merge "Update hacking for Python3"

This commit is contained in:
Zuul 2020-04-04 16:29:00 +00:00 committed by Gerrit Code Review
commit 8a5658760f
8 changed files with 57 additions and 59 deletions

View File

@ -25,9 +25,7 @@ dulwich==0.19.0
extras==1.0.0
fasteners==0.14.1
fixtures==3.0.0
flake8==2.5.5
futurist==1.6.0
hacking==0.12.0
horizon==17.1.0
idna==2.6
imagesize==1.0.0
@ -64,11 +62,9 @@ oslo.utils==3.33.0
osprofiler==2.0.0
packaging==17.1
pbr==2.0.0
pep8==1.5.7
Pint==0.8.1
prettytable==0.7.2
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pymongo==3.6.1

View File

@ -122,7 +122,7 @@ class DeleteReplica(tables.DeleteAction):
replicas = manila.share_replica_list(request, replica.share_id)
if share.replication_type is None:
return False
elif (share.replication_type is 'writable' and
elif (share.replication_type == 'writable' and
replica.status in DELETABLE_STATUSES and
len(replicas) > 1) or (
share.replication_type in ('dr', 'readable') and

View File

@ -108,7 +108,7 @@ class DeleteReplica(tables.DeleteAction):
replicas = manila.share_replica_list(request, replica.share_id)
if share.replication_type is None:
return False
elif (share.replication_type is 'writable' and
elif (share.replication_type == 'writable' and
replica.status in DELETABLE_STATUSES and
len(replicas) > 1) or (
share.replication_type in ('dr', 'readable') and

View File

@ -44,7 +44,7 @@ def parse_str_meta(meta_s):
for string in strings:
if string.count("=") == 0:
# Key for unsetting
key = string.strip('\"\'\ ')
key = string.strip(r'\"\' ')
if len(key) not in range(1, 256):
msg = _("Key '%s' has improper length.") % key
elif " " in key:
@ -53,7 +53,7 @@ def parse_str_meta(meta_s):
unset_list.append(key)
else:
# Key-value pair for setting
pair = [p.strip('\"\'\ ') for p in string.split("=", 1)]
pair = [p.strip(r'\"\' ') for p in string.split("=", 1)]
if not all(len(p) in range(1, 256) for p in pair):
msg = _("All keys and values must be in range from 1 to 255.")
elif pair[0] in list(set_dict.keys()):

View File

@ -635,34 +635,34 @@ class ShareViewTests(test.APITestCase):
data.update({'is_public': is_public})
with self.settings(OPENSTACK_MANILA_FEATURES={
'enable_public_shares': enable_public_shares}):
form = _get_form()
result = form.handle(self.request, data)
self.assertTrue(result)
self.assertEqual(
enable_public_shares,
form.enable_public_shares)
if enable_public_shares:
self.assertIn("is_public", form.fields)
self.assertTrue(form.fields["is_public"])
else:
self.assertNotIn("is_public", form.fields)
api_manila.share_create.assert_called_once_with(
self.request,
availability_zone=data['availability_zone'],
description=data['description'],
is_public=is_public,
metadata=utils.parse_str_meta(data['metadata'])[0],
name=data['name'],
proto=data['share_proto'],
share_group_id=None,
share_network=test_data.active_share_network.id,
share_type=data['share_type'],
size=data['size'],
snapshot_id=data['snapshot_id'],
)
horizon_messages.success.assert_called_once_with(
self.request, mock.ANY)
'enable_public_shares': enable_public_shares}):
form = _get_form()
result = form.handle(self.request, data)
self.assertTrue(result)
self.assertEqual(
enable_public_shares,
form.enable_public_shares)
if enable_public_shares:
self.assertIn("is_public", form.fields)
self.assertTrue(form.fields["is_public"])
else:
self.assertNotIn("is_public", form.fields)
api_manila.share_create.assert_called_once_with(
self.request,
availability_zone=data['availability_zone'],
description=data['description'],
is_public=is_public,
metadata=utils.parse_str_meta(data['metadata'])[0],
name=data['name'],
proto=data['share_proto'],
share_group_id=None,
share_network=test_data.active_share_network.id,
share_type=data['share_type'],
size=data['size'],
snapshot_id=data['snapshot_id'],
)
horizon_messages.success.assert_called_once_with(
self.request, mock.ANY)
@ddt.data((True, True), (True, False), (False, False))
@ddt.unpack
@ -689,24 +689,24 @@ class ShareViewTests(test.APITestCase):
data.update({'is_public': is_public})
with self.settings(OPENSTACK_MANILA_FEATURES={
'enable_public_shares': enable_public_shares}):
form = _get_form(initial)
result = form.handle(self.request, data)
self.assertTrue(result)
self.assertEqual(
enable_public_shares,
form.enable_public_shares)
if enable_public_shares:
self.assertIn("is_public", form.fields)
self.assertTrue(form.fields["is_public"])
else:
self.assertNotIn("is_public", form.fields)
api_manila.share_update.assert_called_once_with(
self.request,
self.share,
data['name'],
data['description'],
is_public=is_public,
)
horizon_messages.success.assert_called_once_with(
self.request, mock.ANY)
'enable_public_shares': enable_public_shares}):
form = _get_form(initial)
result = form.handle(self.request, data)
self.assertTrue(result)
self.assertEqual(
enable_public_shares,
form.enable_public_shares)
if enable_public_shares:
self.assertIn("is_public", form.fields)
self.assertTrue(form.fields["is_public"])
else:
self.assertNotIn("is_public", form.fields)
api_manila.share_update.assert_called_once_with(
self.request,
self.share,
data['name'],
data['description'],
is_public=is_public,
)
horizon_messages.success.assert_called_once_with(
self.request, mock.ANY)

View File

@ -25,6 +25,7 @@ def data(TEST):
"publicURL": "http://public.manila.example.com:8786/v1"}]},
)
projects = [
type("%sProject" % v, (object, ),
{'id': '%s_id' % v, 'name': '%s_name' % v})

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0
hacking>=3.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
python-subunit>=1.0.0 # Apache-2.0/BSD

View File

@ -79,7 +79,8 @@ show-source = True
# F405 TEMPLATES may be undefined, or defined from star imports
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
# H405 multi line docstring summary not separated with an empty line
ignore = E123,E125,F405,H405
# W504 line break after binary operator
ignore = E123,E125,F405,H405,W504
enable-extensions = H203,H106
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools