From 1c3a3f2248f64c7bfa13f145ee1691785a375a0c Mon Sep 17 00:00:00 2001 From: Eyal Date: Tue, 7 Jan 2020 14:58:46 +0200 Subject: [PATCH] Update hacking and fix warning Change-Id: If1358bcfc3f914956f8917cbbcea894f6264febc --- mistral_lib/actions/context.py | 1 + mistral_lib/actions/types.py | 1 + mistral_lib/tests/actions/test_context.py | 40 +++++++++++------------ mistral_lib/utils/__init__.py | 4 +-- test-requirements.txt | 2 +- tox.ini | 2 +- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/mistral_lib/actions/context.py b/mistral_lib/actions/context.py index 974919a..65cf86a 100644 --- a/mistral_lib/actions/context.py +++ b/mistral_lib/actions/context.py @@ -103,4 +103,5 @@ class ActionContextSerializer(serialization.DictBasedSerializer): execution_ctx=ExecutionContext(**entity_dict['execution']) ) + serialization.register_serializer(ActionContext, ActionContextSerializer()) diff --git a/mistral_lib/actions/types.py b/mistral_lib/actions/types.py index a77b96f..f9ae568 100644 --- a/mistral_lib/actions/types.py +++ b/mistral_lib/actions/types.py @@ -78,4 +78,5 @@ class ResultSerializer(serialization.DictBasedSerializer): entity_dict.get('cancel', False) ) + serialization.register_serializer(Result, ResultSerializer()) diff --git a/mistral_lib/tests/actions/test_context.py b/mistral_lib/tests/actions/test_context.py index 95548c3..b0cff17 100644 --- a/mistral_lib/tests/actions/test_context.py +++ b/mistral_lib/tests/actions/test_context.py @@ -15,28 +15,28 @@ from mistral_lib.tests import base as tests_base def _fake_context(): - security_ctx = context.SecurityContext( - auth_uri='auth_uri', - auth_cacert='auth_cacert', - insecure='insecure', - service_catalog='service_catalog', - region_name='region_name', - is_trust_scoped='is_trust_scoped', - redelivered='redelivered', - expires_at='expires_at', - trust_id='trust_id', - is_target='is_target', - project_id='project_id') + security_ctx = context.SecurityContext( + auth_uri='auth_uri', + auth_cacert='auth_cacert', + insecure='insecure', + service_catalog='service_catalog', + region_name='region_name', + is_trust_scoped='is_trust_scoped', + redelivered='redelivered', + expires_at='expires_at', + trust_id='trust_id', + is_target='is_target', + project_id='project_id') - execution_ctx = context.ExecutionContext( - workflow_execution_id='workflow_execution_id', - task_execution_id='task_execution_id', - action_execution_id='action_execution_id', - workflow_name='workflow_name', - callback_url='callback_url') + execution_ctx = context.ExecutionContext( + workflow_execution_id='workflow_execution_id', + task_execution_id='task_execution_id', + action_execution_id='action_execution_id', + workflow_name='workflow_name', + callback_url='callback_url') - ctx = context.ActionContext(security_ctx, execution_ctx) - return ctx + ctx = context.ActionContext(security_ctx, execution_ctx) + return ctx class TestActionsBase(tests_base.TestCase): diff --git a/mistral_lib/utils/__init__.py b/mistral_lib/utils/__init__.py index db9838b..1ca815d 100644 --- a/mistral_lib/utils/__init__.py +++ b/mistral_lib/utils/__init__.py @@ -248,7 +248,7 @@ def cut_dict(d, length=100): idx += 1 - if 0 <= length <= len(res) and res[length - 1] is not '}': + if 0 <= length <= len(res) and res[length - 1] != '}': res = res[:length - 3] + '...' return res @@ -283,7 +283,7 @@ def cut_list(l, length=100): res += "'%s'" % s if is_str else s res += ', ' if idx < len(l) - 1 else ']' - if 0 <= length <= len(res) and res[length - 1] is not ']': + if 0 <= length <= len(res) and res[length - 1] != ']': res = res[:length - 3] + '...' return res diff --git a/test-requirements.txt b/test-requirements.txt index 1667311..ff76531 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 sphinx>=1.8.0,<2.0.0;python_version=='2.7' # BSD sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD diff --git a/tox.ini b/tox.ini index 00e8abb..58f642f 100644 --- a/tox.ini +++ b/tox.ini @@ -58,7 +58,7 @@ commands = oslo_debug_helper -t mistral_lib/tests {posargs} # E123, E125 skipped as they are invalid PEP-8. show-source = True -ignore = E123,E125 +ignore = E123,E125,W504 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build