[Piglit] [PATCH 3/8] framework: Avoid magic number usage in making skip and problems lists.

Eric Anholt eric at anholt.net
Wed Sep 18 15:00:28 PDT 2013


I broke these two pages when doing the unstable-result change, because
I didn't expect absolute numbers to be used on this thing that looked
like it was for relative severity comparisons.
---
 framework/summary.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 26bdda9..656efc0 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -432,11 +432,14 @@ class Summary:
 
         for test in self.tests['all']:
             status = []
+            status_text = []
             for each in self.results:
                 try:
-                    status.append(find_regressions(each.tests[test]['result']))
+                    s = each.tests[test]['result']
                 except KeyError:
-                    status.append(find_regressions("special"))
+                    s = 'special'
+                status_text.append(s)
+                status.append(find_regressions(s))
 
             if 'changes' in lists:
                 # Check and append self.tests['changes']
@@ -447,15 +450,12 @@ class Summary:
                     self.tests['changes'].add(test)
 
             if 'problems' in lists:
-                # If the result contains a value other than 1 (pass) or 4
-                # (skip) it is a problem. Skips are not problems becasuse
-                # they have Their own page.
-                if [i for e in [2, 3, 5] for i in status if e is i]:
-                    self.tests['problems'].add(test)
+                for i in status_text:
+                    if i not in ['pass', 'skip', 'special']:
+                        self.tests['problems'].add(test)
 
             if 'skipped' in lists:
-                # Find all tests with a status of skip
-                if 4 in status:
+                if 'skip' in status_text:
                     self.tests['skipped'].add(test)
 
             if 'fixes' in lists:
-- 
1.8.4.rc3



More information about the Piglit mailing list