[Piglit] [PATCH 6/9] tests/oglconform.py: minor refactor to simplify try/except block

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Oct 21 11:06:31 PDT 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

This moves code out of the try/except block that we don't mean to catch
exceptions in, which is better coding practice.

This also sets the except block to ValueError only, which is the error
that will occur if there aren't enough values to unpack, which the
except block was added to catch.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/oglconform.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/oglconform.py b/tests/oglconform.py
index 1772fa2..ebf2c97 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -81,11 +81,12 @@ def _make_profile():
         for l in f.readlines():
             try:
                 category, test = l.split()
-                group = grouptools.join('oglconform', category, test)
-                profile.test_list[group] = OGLCTest(category, test)
-            except:
+            except ValueError:
                 continue
 
+            group = grouptools.join('oglconform', category, test)
+            profile.test_list[group] = OGLCTest(category, test)
+
     return profile
 
 
-- 
2.6.1



More information about the Piglit mailing list