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

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Mon Oct 26 11:58:57 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 c74f3fe..ca3b49f 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -80,11 +80,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.2



More information about the Piglit mailing list