[Piglit] [PATCH 2/9] summary.py: Replace try/except with a list comprehension

Dylan Baker baker.dylan.c at gmail.com
Tue Oct 15 12:13:24 CEST 2013


This is equivalent but simpler.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index c6b903b..62cd91a 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -378,12 +378,7 @@ class Summary:
         # Create the lists of statuses like problems, regressions, fixes,
         # changes and skips
         for test in self.tests['all']:
-            status = []
-            for each in self.results:
-                try:
-                    status.append(each.tests[test]['result'])
-                except KeyError:
-                    status.append(so.NotRun())
+            status = [i.tests[test].get('result', so.NotRun()) for i in self.results]
 
             # Problems include: warn, dmesg-warn, fail, dmesg-fail, and crash.
             # Skip does not go on this page, it has the 'skipped' page
-- 
1.8.1.5



More information about the Piglit mailing list