This allows us to raise a piglit specific error, but to still see the
traceback of the original exception

Signed-off-by: Dylan Baker <[email protected]>
---
 framework/tests/core_tests.py | 4 ++--
 framework/tests/utils.py      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/tests/core_tests.py b/framework/tests/core_tests.py
index 66a2f7b..5b71f3a 100644
--- a/framework/tests/core_tests.py
+++ b/framework/tests/core_tests.py
@@ -67,7 +67,7 @@ def _save_core_config(func):
                 restore_piglitconf = True
             core.PIGLIT_CONFIG = core.PiglitConfig(allow_no_value=True)
         except Exception as e:
-            raise utils.UtilsError(e)
+            raise utils.UtilsError from e
 
         func(*args, **kwargs)
 
@@ -83,7 +83,7 @@ def _save_core_config(func):
             core.PIGLIT_CONFIG = core.PiglitConfig(
                 allow_no_value=True)
         except Exception as e:
-            raise utils.UtilsError(e)
+            raise utils.UtilsError from e
 
     return inner
 
diff --git a/framework/tests/utils.py b/framework/tests/utils.py
index 2b2f653..eb13317 100644
--- a/framework/tests/utils.py
+++ b/framework/tests/utils.py
@@ -145,7 +145,7 @@ class DocFormatter(object):
         except KeyError as e:
             # We want to catch this to ensure that a test that is looking for a
             # KeyError doesn't pass when it shouldn't
-            raise UtilsError(e)
+            raise UtilsError from e
 
         return func
 
-- 
2.4.5

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to