[Piglit] [PATCH 5/5] framework: make exception reporting better using `raise from`
Dylan Baker
baker.dylan.c at gmail.com
Thu Jul 9 14:25:45 PDT 2015
This allows us to raise a piglit specific error, but to still see the
traceback of the original exception
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
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
More information about the Piglit
mailing list