Bump hacking
hacking 3.0.x is too old. Change-Id: I33875c36dbbdb946841f8c583636ccdf88d3331f
This commit is contained in:
parent
b6b9f043ff
commit
9f896ab03d
@ -508,8 +508,10 @@ def replication_load(options, args):
|
||||
_check_upload_response_headers(headers, body)
|
||||
updated.append(meta['id'])
|
||||
except exc.HTTPConflict:
|
||||
LOG.error(_LE(IMAGE_ALREADY_PRESENT_MESSAGE)
|
||||
% image_uuid) # noqa
|
||||
# NOTE(tkajinam): noqa does not work with multi-line,
|
||||
# so split this interpolation to a separate line
|
||||
msg = _LE(IMAGE_ALREADY_PRESENT_MESSAGE) % image_uuid
|
||||
LOG.error(msg)
|
||||
|
||||
return updated
|
||||
|
||||
|
@ -41,7 +41,7 @@ class WSMEModelTransformer(object):
|
||||
for name in names:
|
||||
value = getattr(db_entity, name, None)
|
||||
if value is not None:
|
||||
if type(value) == datetime:
|
||||
if isinstance(value, datetime):
|
||||
iso_datetime_value = timeutils.isotime(value)
|
||||
values.update({name: iso_datetime_value})
|
||||
else:
|
||||
|
@ -1028,7 +1028,7 @@ def _task_soft_delete(context):
|
||||
tasks = DATA['tasks'].values()
|
||||
|
||||
for task in tasks:
|
||||
if(task['owner'] == context.owner and task['deleted'] == False
|
||||
if (task['owner'] == context.owner and task['deleted'] == False
|
||||
and task['expires_at'] <= now):
|
||||
|
||||
task['deleted'] = True
|
||||
|
@ -392,7 +392,7 @@ def _paginate_query(query, model, limit, sort_keys, marker=None,
|
||||
# the actual primary key, rather than assuming its id
|
||||
LOG.warning(_LW('Id not in sort_keys; is sort_keys unique?'))
|
||||
|
||||
assert(not (sort_dir and sort_dirs)) # nosec
|
||||
assert (not (sort_dir and sort_dirs)) # nosec
|
||||
# nosec: This function runs safely if the assertion fails.
|
||||
|
||||
# Default the sort direction to ascending
|
||||
@ -403,7 +403,7 @@ def _paginate_query(query, model, limit, sort_keys, marker=None,
|
||||
if sort_dirs is None:
|
||||
sort_dirs = [sort_dir] * len(sort_keys)
|
||||
|
||||
assert(len(sort_dirs) == len(sort_keys)) # nosec
|
||||
assert (len(sort_dirs) == len(sort_keys)) # nosec
|
||||
# nosec: This function runs safely if the assertion fails.
|
||||
if len(sort_dirs) < len(sort_keys):
|
||||
sort_dirs += [sort_dir] * (len(sort_keys) - len(sort_dirs))
|
||||
|
@ -95,7 +95,7 @@ def no_translate_debug_logs(logical_line, filename):
|
||||
|
||||
if max([name in filename for name in dirs]):
|
||||
if logical_line.startswith("LOG.debug(_("):
|
||||
yield(0, "G319: Don't translate debug level logs")
|
||||
yield (0, "G319: Don't translate debug level logs")
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
@ -105,7 +105,7 @@ def check_no_contextlib_nested(logical_line):
|
||||
"nested for more information.")
|
||||
if ("with contextlib.nested(" in logical_line or
|
||||
"with nested(" in logical_line):
|
||||
yield(0, msg)
|
||||
yield (0, msg)
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
|
@ -167,8 +167,8 @@ def format_image_notification(image):
|
||||
|
||||
|
||||
def format_image_member_notification(image_member):
|
||||
"""Given a glance.domain.ImageMember object, return a dictionary of relevant
|
||||
notification information.
|
||||
"""Given a glance.domain.ImageMember object, return a dictionary of
|
||||
relevant notification information.
|
||||
"""
|
||||
return {
|
||||
'image_id': image_member.image_id,
|
||||
|
@ -83,7 +83,7 @@ ADMIN_OR_PROJECT_READER_OR_SHARED_MEMBER = (
|
||||
f'role:reader and (project_id:%(project_id)s or {IMAGE_MEMBER_CHECK})'
|
||||
)
|
||||
|
||||
ADMIN = f'rule:context_is_admin'
|
||||
ADMIN = 'rule:context_is_admin'
|
||||
|
||||
rules = [
|
||||
policy.RuleDefault(name='default', check_str='',
|
||||
|
@ -2256,7 +2256,7 @@ class VisibilityTests(object):
|
||||
is_public=False)
|
||||
self.assertEqual(8, len(images))
|
||||
for i in images:
|
||||
self.assertTrue(i['visibility'] in ['shared', 'private'])
|
||||
self.assertIn(i['visibility'], ['shared', 'private'])
|
||||
|
||||
def test_unknown_admin_is_public_none(self):
|
||||
images = self.db_api.image_get_all(self.admin_none_context)
|
||||
@ -2310,8 +2310,7 @@ class VisibilityTests(object):
|
||||
is_public=False)
|
||||
self.assertEqual(9, len(images))
|
||||
for i in images:
|
||||
self.assertTrue(i['visibility']
|
||||
in ['shared', 'private', 'community'])
|
||||
self.assertIn(i['visibility'], ['shared', 'private', 'community'])
|
||||
|
||||
def test_known_admin_is_public_none(self):
|
||||
images = self.db_api.image_get_all(self.admin_context)
|
||||
@ -2429,8 +2428,7 @@ class VisibilityTests(object):
|
||||
self.assertEqual(3, len(images))
|
||||
for i in images:
|
||||
self.assertEqual(i['owner'], self.tenant1)
|
||||
self.assertTrue(i['visibility']
|
||||
in ['private', 'shared', 'community'])
|
||||
self.assertIn(i['visibility'], ['private', 'shared', 'community'])
|
||||
|
||||
def test_tenant1_is_public_none(self):
|
||||
images = self.db_api.image_get_all(self.tenant1_context)
|
||||
|
@ -155,7 +155,7 @@ class TestMetadefObjects(metadef_base.MetadefFunctionalTestBase):
|
||||
'description',
|
||||
])
|
||||
for key, value in expected_metadata_object.items():
|
||||
if(key in checked_values):
|
||||
if key in checked_values:
|
||||
self.assertEqual(metadata_object[key], value, key)
|
||||
# Complex key values - properties
|
||||
for key, value in (
|
||||
|
@ -112,7 +112,7 @@ class TestMetadefResourceTypes(metadef_base.MetadefFunctionalTestBase):
|
||||
u'properties_target',
|
||||
])
|
||||
for key, value in expected_metadef_resource_types.items():
|
||||
if(key in checked_values):
|
||||
if key in checked_values:
|
||||
self.assertEqual(
|
||||
resource_type['resource_type_associations'][0][key],
|
||||
value, key)
|
||||
|
@ -86,7 +86,7 @@ class TestMetadefTags(metadef_base.MetadefFunctionalTestBase):
|
||||
'name'
|
||||
])
|
||||
for key, value in expected_metadata_tag.items():
|
||||
if(key in checked_values):
|
||||
if key in checked_values:
|
||||
self.assertEqual(metadata_tag[key], value, key)
|
||||
|
||||
# Try to create a duplicate metadata tag
|
||||
|
@ -112,7 +112,7 @@ class TestTaskExecutor(test_utils.BaseTestCase):
|
||||
|
||||
def test_task_fail_upload(self):
|
||||
with mock.patch.object(image_import, 'set_image_data') as import_mock:
|
||||
import_mock.side_effect = IOError
|
||||
import_mock.side_effect = IOError # noqa
|
||||
|
||||
self.task_repo.get.return_value = self.task
|
||||
self.executor.begin_processing(self.task.task_id)
|
||||
|
@ -702,9 +702,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.fail('Notification contained location field.')
|
||||
# Verify newly added fields 'image_id', 'user_id' and
|
||||
# 'request_id' are not part of notification yet
|
||||
self.assertTrue('image_id' not in output_log['payload'])
|
||||
self.assertTrue('user_id' not in output_log['payload'])
|
||||
self.assertTrue('request_id' not in output_log['payload'])
|
||||
self.assertNotIn('image_id', output_log['payload'])
|
||||
self.assertNotIn('user_id', output_log['payload'])
|
||||
self.assertNotIn('request_id', output_log['payload'])
|
||||
|
||||
def test_task_create_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.create'])
|
||||
@ -737,9 +737,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.fail('Notification contained location field.')
|
||||
# Verify newly added fields 'image_id', 'user_id' and
|
||||
# 'request_id' are not part of notification yet
|
||||
self.assertTrue('image_id' not in output_log['payload'])
|
||||
self.assertTrue('user_id' not in output_log['payload'])
|
||||
self.assertTrue('request_id' not in output_log['payload'])
|
||||
self.assertNotIn('image_id', output_log['payload'])
|
||||
self.assertNotIn('user_id', output_log['payload'])
|
||||
self.assertNotIn('request_id', output_log['payload'])
|
||||
|
||||
def test_task_delete_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.delete'])
|
||||
@ -758,15 +758,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.assertEqual('INFO', output_log['notification_type'])
|
||||
self.assertEqual('task.run', output_log['event_type'])
|
||||
self.assertEqual(self.task.task_id, output_log['payload']['id'])
|
||||
self.assertFalse(
|
||||
self.task.image_id in output_log['payload']
|
||||
)
|
||||
self.assertFalse(
|
||||
self.task.user_id in output_log['payload']
|
||||
)
|
||||
self.assertFalse(
|
||||
self.task.request_id in output_log['payload']
|
||||
)
|
||||
self.assertNotIn(self.task.image_id, output_log['payload'])
|
||||
self.assertNotIn(self.task.user_id, output_log['payload'])
|
||||
self.assertNotIn(self.task.request_id, output_log['payload'])
|
||||
|
||||
def test_task_run_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.run'])
|
||||
@ -787,9 +781,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.assertEqual(self.task.task_id, output_log['payload']['id'])
|
||||
# Verify newly added fields 'image_id', 'user_id' and
|
||||
# 'request_id' are not part of notification yet
|
||||
self.assertTrue('image_id' not in output_log['payload'])
|
||||
self.assertTrue('user_id' not in output_log['payload'])
|
||||
self.assertTrue('request_id' not in output_log['payload'])
|
||||
self.assertNotIn('image_id', output_log['payload'])
|
||||
self.assertNotIn('user_id', output_log['payload'])
|
||||
self.assertNotIn('request_id', output_log['payload'])
|
||||
|
||||
def test_task_processing_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.processing'])
|
||||
@ -808,9 +802,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.assertEqual(self.task.task_id, output_log['payload']['id'])
|
||||
# Verify newly added fields 'image_id', 'user_id' and
|
||||
# 'request_id' are not part of notification yet
|
||||
self.assertTrue('image_id' not in output_log['payload'])
|
||||
self.assertTrue('user_id' not in output_log['payload'])
|
||||
self.assertTrue('request_id' not in output_log['payload'])
|
||||
self.assertNotIn('image_id', output_log['payload'])
|
||||
self.assertNotIn('user_id', output_log['payload'])
|
||||
self.assertNotIn('request_id', output_log['payload'])
|
||||
|
||||
def test_task_success_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.processing', 'task.success'])
|
||||
@ -829,9 +823,9 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.assertEqual(self.task.task_id, output_log['payload']['id'])
|
||||
# Verify newly added fields 'image_id', 'user_id' and
|
||||
# 'request_id' are not part of notification yet
|
||||
self.assertTrue('image_id' not in output_log['payload'])
|
||||
self.assertTrue('user_id' not in output_log['payload'])
|
||||
self.assertTrue('request_id' not in output_log['payload'])
|
||||
self.assertNotIn('image_id', output_log['payload'])
|
||||
self.assertNotIn('user_id', output_log['payload'])
|
||||
self.assertNotIn('request_id', output_log['payload'])
|
||||
|
||||
def test_task_failure_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.failure'])
|
||||
|
@ -1,7 +1,3 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
pbr>=3.1.1 # Apache-2.0
|
||||
defusedxml>=0.6.0 # PSF
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking>=3.0.1,<3.1.0 # Apache-2.0
|
||||
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||
|
||||
# Needed for testing
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user