Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Change-Id: Ia621c3fea2b8ded8df7727c07931ad071a61e736
This commit is contained in:
parent
ed80204406
commit
e71c636dfa
@ -116,4 +116,5 @@ class CompositeRule(wtypes.UserType):
|
||||
def __call__(**rule):
|
||||
return rule
|
||||
|
||||
|
||||
composite_rule = CompositeRule()
|
||||
|
@ -100,7 +100,7 @@ class ValidatedComplexQuery(object):
|
||||
valid_fields = _list_to_regexp(valid_keys)
|
||||
|
||||
if metadata_allowed:
|
||||
valid_filter_fields = valid_fields + "|^metadata\.[\S]+$"
|
||||
valid_filter_fields = valid_fields + r"|^metadata\.[\S]+$"
|
||||
else:
|
||||
valid_filter_fields = valid_fields
|
||||
|
||||
|
@ -113,7 +113,7 @@ class ParsableErrorMiddleware(object):
|
||||
if error is not None and 'faultstring' in fault:
|
||||
fault['faultstring'] = i18n.translate(error,
|
||||
user_locale)
|
||||
except ValueError as err:
|
||||
except ValueError:
|
||||
fault = app_data
|
||||
body = json.dumps({'error_message': fault})
|
||||
if six.PY3:
|
||||
|
@ -198,7 +198,7 @@ class AlarmEvaluationService(cotyledon.Service):
|
||||
super(AlarmEvaluationService, self).__init__(worker_id)
|
||||
self.conf = conf
|
||||
|
||||
ef = lambda: futures.ThreadPoolExecutor(max_workers=10)
|
||||
ef = lambda: futures.ThreadPoolExecutor(max_workers=10) # noqa: E731
|
||||
self.periodic = periodics.PeriodicWorker.create(
|
||||
[], executor_factory=ef)
|
||||
|
||||
|
@ -86,7 +86,7 @@ class LoadBalancerMemberHealthEvaluator(evaluator.Evaluator):
|
||||
for m in ret.get("members", []):
|
||||
try:
|
||||
created_time = parser.parse(m['created_at'], ignoretz=True)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
LOG.warning('Failed to parse the member created time.')
|
||||
continue
|
||||
|
||||
|
@ -82,6 +82,7 @@ def run_migrations_online():
|
||||
context.run_migrations()
|
||||
conn.disconnect()
|
||||
|
||||
|
||||
if not hasattr(config, "conf"):
|
||||
from aodh import service
|
||||
config.conf = service.prepare_service([])
|
||||
|
@ -32,14 +32,14 @@ class TestQuotas(v2.FunctionalTest):
|
||||
resp = self.get_json('/quotas', headers=self.auth_headers, status=200)
|
||||
|
||||
self.assertEqual(self.project, resp.get('project_id'))
|
||||
self.assertTrue(len(resp.get('quotas', [])) > 0)
|
||||
self.assertGreater(len(resp.get('quotas', [])), 0)
|
||||
|
||||
def test_get_project_quotas_by_user(self):
|
||||
resp = self.get_json('/quotas?project_id=%s' % self.project,
|
||||
headers=self.auth_headers, status=200)
|
||||
|
||||
self.assertEqual(self.project, resp.get('project_id'))
|
||||
self.assertTrue(len(resp.get('quotas', [])) > 0)
|
||||
self.assertGreater(len(resp.get('quotas', [])), 0)
|
||||
|
||||
def test_get_other_project_quotas_by_user_failed(self):
|
||||
self.get_json(
|
||||
@ -58,7 +58,7 @@ class TestQuotas(v2.FunctionalTest):
|
||||
status=200)
|
||||
|
||||
self.assertEqual(self.other_project, resp.get('project_id'))
|
||||
self.assertTrue(len(resp.get('quotas', [])) > 0)
|
||||
self.assertGreater(len(resp.get('quotas', [])), 0)
|
||||
|
||||
def test_post_quotas_by_admin(self):
|
||||
auth_headers = copy.copy(self.auth_headers)
|
||||
|
5
tox.ini
5
tox.ini
@ -80,7 +80,10 @@ setenv = OS_TEST_PATH=aodh/tests/functional/
|
||||
commands = pifpaf -g AODH_TEST_STORAGE_URL run postgresql -- oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore =
|
||||
# W503 line break before binary operator
|
||||
# W504 line break after binary operator
|
||||
# E402 module level import not at top of file
|
||||
ignore = W503,W504,E402
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
# [H106] Do not put vim configuration in source files.
|
||||
# [H203] Use assertIs(Not)None to check for None.
|
||||
|
Loading…
Reference in New Issue
Block a user