From dc2b80af49b2c9cc5c8cdac3824934e77df1cade Mon Sep 17 00:00:00 2001 From: Tomi Sarvela Date: Thu, 9 Feb 2017 20:22:18 +0200 Subject: framework/results.py: Copy 'tests' internally to OrderedDict To preserve the original test running order, use OrderedDict when copying 'tests' values over. Reviewed-by: Dylan Baker --- framework/results.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'framework') diff --git a/framework/results.py b/framework/results.py index 1a73c11b0..4cfe78250 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() -- cgit v1.2.3