[Piglit] [PATCH v2 1/2] framework/results.py: Copy 'tests' internally to OrderedDict

Tomi Sarvela tomi.p.sarvela at intel.com
Thu Feb 9 18:22:18 UTC 2017


To preserve the original test running order, use OrderedDict
when copying 'tests' values over.
---
 framework/results.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index 1a73c11..4cfe782 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -350,7 +350,8 @@ class TestrunResult(object):
         if not self.totals:
             self.calculate_group_totals()
         rep = copy.copy(self.__dict__)
-        rep['tests'] = {k: t.to_json() for k, t in six.iteritems(self.tests)}
+        rep['tests'] = collections.OrderedDict((k, t.to_json())
+                       for k, t in six.iteritems(self.tests))
         rep['__type__'] = 'TestrunResult'
         return rep
 
@@ -378,8 +379,8 @@ class TestrunResult(object):
         if 'time_elapsed' in dict_:
             setattr(res, 'time_elapsed',
                     TimeAttribute.from_dict(dict_['time_elapsed']))
-        res.tests = {n: TestResult.from_dict(t)
-                     for n, t in six.iteritems(dict_['tests'])}
+        res.tests = collections.OrderedDict((n, TestResult.from_dict(t))
+                    for n, t in six.iteritems(dict_['tests']))
 
         if not 'totals' in dict_ and not _no_totals:
             res.calculate_group_totals()
-- 
2.9.3



More information about the Piglit mailing list