Python 3: fix glance.tests.functional.db.test_sqlalchemy

This patch fixes 3 issues:
- "RuntimeError: dictionary changed size during iteration"
- "TypeError: 'map' object is not subscriptable"
- "TypeError: object of type 'map' has no len()"

Change-Id: If52ab336512f37b6e5ad6c748bef7996c67cb71a
This commit is contained in:
Cyril Roelandt 2016-11-24 13:52:38 +01:00
parent c366881f30
commit 6540f9319a
4 changed files with 5 additions and 4 deletions

View File

@ -1412,7 +1412,7 @@ def task_create(context, values, session=None):
def _pop_task_info_values(values):
task_info_values = {}
for k, v in values.items():
for k, v in list(values.items()):
if k in ['input', 'result', 'message']:
values.pop(k)
task_info_values[k] = v

View File

@ -253,8 +253,8 @@ def get_all(context, session, marker=None, limit=None,
context, session, filters, marker,
limit, sort_keys, sort_dirs, show_level)
return map(lambda ns: _out(ns, show_level, show_text_properties=False),
artifacts)
return [_out(ns, show_level, show_text_properties=False)
for ns in artifacts]
def _get_all(context, session, filters=None, marker=None,

View File

@ -206,7 +206,7 @@ def get_all(context, session, marker=None, limit=None,
namespaces = _get_all(
context, session, filters, marker, limit, sort_key, sort_dir)
return map(lambda ns: ns.to_dict(), namespaces)
return [ns.to_dict() for ns in namespaces]
def get(context, name, session):

View File

@ -43,6 +43,7 @@ commands =
glance.tests.functional.test_cors_middleware \
glance.tests.functional.test_logging \
glance.tests.functional.db.test_simple \
glance.tests.functional.db.test_sqlalchemy \
glance.tests.functional.db.test_rpc_endpoint \
glance.tests.functional.v1.test_multiprocessing \
glance.tests.functional.v2.test_metadef_objects \