[v2,07/16] tests/oglconform.py: Use new error handling code

Submitted by Dylan Baker on May 18, 2015, 5:57 p.m.

Details

Message ID 1431971870-20138-8-git-send-email-baker.dylan.c@gmail.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Dylan Baker May 18, 2015, 5:57 p.m.
This uses the new exceptions and new PiglitConfig methods.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
---
 framework/tests/integration_tests.py | 7 ++++++-
 tests/oglconform.py                  | 9 ++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/framework/tests/integration_tests.py b/framework/tests/integration_tests.py
index ac0e31c..664fad1 100644
--- a/framework/tests/integration_tests.py
+++ b/framework/tests/integration_tests.py
@@ -32,7 +32,7 @@  import ConfigParser
 
 from nose.plugins.skip import SkipTest
 
-from framework import core
+from framework import core, exceptions
 
 
 def setup_module():
@@ -50,9 +50,14 @@  def _import(name):
     """
     try:
         return importlib.import_module(name)
+    except exceptions.PiglitFatalError:
+        raise SkipTest('The module experienced a fatal error. '
+                       'This may be expected.')
     except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
+        # FIXME: This is a legacy path
         raise SkipTest('No config section for {}'.format(name))
     except SystemExit as e:
+        # FIXME: This is a legacy path
         if e.code == 0:
             # This means that it's a normal operation, but not that it's a pass
             raise SkipTest('Profile exited normally.')
diff --git a/tests/oglconform.py b/tests/oglconform.py
index f2e161e..4ec127e 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -23,19 +23,18 @@ 
 
 import os
 import re
-import sys
 import subprocess
 
-import framework.grouptools as grouptools
-import framework.core
+from framework import grouptools, exceptions, core
 from framework.profile import TestProfile, Test
 
 __all__ = ['profile']
 
-bin_oglconform = framework.core.PIGLIT_CONFIG.get('oglconform', 'path')
+bin_oglconform = core.PIGLIT_CONFIG.required_get('oglconform', 'path')
 
 if not os.path.exists(bin_oglconform):
-    sys.exit(0)
+    raise exceptions.PiglitFatalError(
+        'Cannot find binary {}'.format(bin_oglconform))
 
 profile = TestProfile()