summaryrefslogtreecommitdiff
path: root/framework/backends
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-01-04 17:38:17 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2016-02-08 12:29:34 -0800
commita55abb88e0893b9b40392d04467880072c42109a (patch)
tree1a79e56938706375a48c9d0eab33e6f19034b798 /framework/backends
parentb4a47de0cee7183bba278b1996afdd01069dd220 (diff)
python: use six.{iter,view}{items,keys,values}
This was initially generated via the following sed command: sed -i \ -e 's@in \(.*\)\.iter\(values,keys,items\)()@in six.iter\2(\1)@g' \ -e 's@in \(.*\..*\)\.iter\(values,keys,items\)()@in six.iter\2(\1)@g' Then cleaned up by hand, including changes for view*. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'framework/backends')
-rw-r--r--framework/backends/__init__.py4
-rw-r--r--framework/backends/json.py12
2 files changed, 10 insertions, 6 deletions
diff --git a/framework/backends/__init__.py b/framework/backends/__init__.py
index 1b814a2d3..48c791716 100644
--- a/framework/backends/__init__.py
+++ b/framework/backends/__init__.py
@@ -45,6 +45,8 @@ from __future__ import absolute_import, division, print_function
import os
import importlib
+import six
+
from .register import Registry
from .compression import COMPRESSION_SUFFIXES
@@ -160,7 +162,7 @@ def load(file_path):
extension, compression = get_extension(file_path)
- for backend in BACKENDS.itervalues():
+ for backend in six.itervalues(BACKENDS):
if extension in backend.extensions:
loader = backend.load
diff --git a/framework/backends/json.py b/framework/backends/json.py
index 8e4dc13a3..88702e86f 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -31,6 +31,8 @@ try:
except ImportError:
import json
+import six
+
from framework import status, results, exceptions
from .abstract import FileBackend, write_compressed
from .register import Registry
@@ -348,7 +350,7 @@ def _update_zero_to_one(result):
updated_results = {}
remove = set()
- for name, test in result.tests.iteritems():
+ for name, test in six.iteritems(result.tests):
assert not isinstance(test, results.TestResult), \
'Test was erroniaously turned into a TestResult'
@@ -400,7 +402,7 @@ def _update_zero_to_one(result):
#
# this must be the last thing done in this loop, or there will be pain
if test.get('subtest'):
- for sub in test['subtest'].iterkeys():
+ for sub in six.iterkeys(test['subtest']):
# adding the leading / ensures that we get exactly what we
# expect, since endswith does a character by chacter match, if
# the subtest name is duplicated it wont match, and if there
@@ -528,7 +530,7 @@ def _update_four_to_five(results):
"""Updates json results from version 4 to version 5."""
new_tests = {}
- for name, test in results.tests.iteritems():
+ for name, test in six.iteritems(results.tests):
new_tests[name.replace('/', '@').replace('\\', '@')] = test
results.tests = new_tests
@@ -546,7 +548,7 @@ def _update_five_to_six(result):
"""
new_tests = {}
- for name, test in result.tests.iteritems():
+ for name, test in six.iteritems(result.tests):
new_tests[name] = results.TestResult.from_dict(test)
result.tests = new_tests
@@ -578,7 +580,7 @@ def _update_seven_to_eight(result):
This value is used for both TestResult.time and TestrunResult.time_elapsed.
"""
- for test in result.tests.viewvalues():
+ for test in six.viewvalues(result.tests):
test.time = results.TimeAttribute(end=test.time)
result.time_elapsed = results.TimeAttribute(end=result.time_elapsed)