[Piglit] [PATCH 07/10] integration_tests.py: Cleanups of error handling
Dylan Baker
baker.dylan.c at gmail.com
Thu Jan 29 15:31:22 PST 2015
Previously this test would catch SystemExit and report a Skip of "No
config section...", which wasn't accurate. Now it does a little better
handling of determining whether the exit was expected (usually due to
some sort of environment issue), or not and giving a better skip
message.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/tests/integration_tests.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/framework/tests/integration_tests.py b/framework/tests/integration_tests.py
index 0a157a8..472f903 100644
--- a/framework/tests/integration_tests.py
+++ b/framework/tests/integration_tests.py
@@ -39,11 +39,23 @@ framework.core.get_config()
def _import(name):
- """ Helper for importing modules """
+ """Helper for importing modules.
+
+ It is very important that we use import_module to get the module, since we
+ need more than just the profile, since we want to ensure that the Test
+ derived class is importable.
+
+ """
try:
return importlib.import_module(name)
- except (ConfigParser.NoOptionError, ConfigParser.NoSectionError, SystemExit):
+ except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
raise SkipTest('No config section for {}'.format(name))
+ except SystemExit as e:
+ if e.code == 0:
+ # This means that it's a normal operation, but not that it's a pass
+ raise SkipTest('Profile exited normally.')
+ else:
+ raise Exception('Profile exited. code: {}.'.format(e.code))
def test_xts_import():
--
2.2.2
More information about the Piglit
mailing list