Merge "Fix more tests in python34 gate"

This commit is contained in:
Jenkins 2015-09-24 09:33:43 +00:00 committed by Gerrit Code Review
commit d4f949c0ac
6 changed files with 14 additions and 8 deletions

View File

@ -282,7 +282,8 @@ def _get_hash_function_by(column_name):
def calc_hash(context):
d = context.current_parameters[column_name] or {}
return hashlib.sha256(json.dumps(sorted(d.items()))).hexdigest()
return hashlib.sha256(json.dumps(sorted(d.items())).
encode('utf-8')).hexdigest()
return calc_hash

View File

@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
def validate_input(definition, input, spec=None):
input_param_names = copy.copy((input or {}).keys())
input_param_names = copy.copy(list((input or {}).keys()))
missing_param_names = []
spec_input = (spec.get_input() if spec else

View File

@ -125,9 +125,11 @@ class BaseTest(base.BaseTestCase):
return True
filtered_items = filter(lambda item: _matches(item, **props), items)
filtered_items = list(
filter(lambda item: _matches(item, **props), items)
)
found = len(list(filtered_items))
found = len(filtered_items)
if found != count:
LOG.info("[failed test ctx] items=%s, expected_props=%s" % (str(

View File

@ -263,7 +263,7 @@ class BaseSpec(object):
@staticmethod
def _as_tuple(val):
return val.items()[0] if isinstance(val, dict) else (val, '')
return list(val.items())[0] if isinstance(val, dict) else (val, '')
@staticmethod
def _parse_cmd_and_input(cmd_str):

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
from mistral import exceptions as exc
from mistral import utils
from mistral.workbook import types
@ -60,7 +62,7 @@ class WorkflowSpec(base.BaseSpec):
# Inject 'type' here, so instantiate_spec function can recognize the
# specific subclass of TaskSpec.
for task in self._data.get('tasks').itervalues():
for task in six.itervalues(self._data.get('tasks')):
task['type'] = self._type
self._tasks = self._spec_property('tasks', tasks.TaskSpecList)

View File

@ -14,6 +14,7 @@
# limitations under the License.
import copy
import six
from oslo_config import cfg
from oslo_log import log as logging
@ -135,7 +136,7 @@ class ProxyAwareDict(dict):
return d
def iteritems(self):
for k, _ in super(ProxyAwareDict, self).iteritems():
for k, _ in six.iteritems(super(ProxyAwareDict, self)):
yield k, self[k]
def to_builtin_dict(self):
@ -263,7 +264,7 @@ def add_workflow_variables_to_context(wf_ex, wf_spec):
def extract_task_result_proxies_to_context(ctx):
ctx = ProxyAwareDict(copy.deepcopy(ctx))
for task_ex_id, task_ex_name in ctx['__tasks'].iteritems():
for task_ex_id, task_ex_name in six.iteritems(ctx['__tasks']):
ctx[task_ex_name] = TaskResultProxy(task_ex_id)
return ctx