[v2,05/16] tests/xts.py: use new error handling.

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

Details

Message ID 1431971870-20138-6-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 makes use PiglitConfig.required_get for getting required
information, and uses PiglitFatalError rather than exiting on certain
errors.

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

Patch hide | download patch | download mbox

diff --git a/framework/tests/integration_tests.py b/framework/tests/integration_tests.py
index 0971eb3..ac0e31c 100644
--- a/framework/tests/integration_tests.py
+++ b/framework/tests/integration_tests.py
@@ -32,13 +32,12 @@  import ConfigParser
 
 from nose.plugins.skip import SkipTest
 
-import framework.core
+from framework import core
 
 
 def setup_module():
-    framework.core.PIGLIT_CONFIG = ConfigParser.SafeConfigParser(
-        allow_no_value=True)
-    framework.core.get_config()
+    core.PIGLIT_CONFIG = core.PiglitConfig(allow_no_value=True)
+    core.get_config()
 
 
 def _import(name):
diff --git a/tests/xts.py b/tests/xts.py
index 3ac931d..d9e3a3e 100644
--- a/tests/xts.py
+++ b/tests/xts.py
@@ -26,17 +26,15 @@ 
 from __future__ import print_function, division, absolute_import
 import os
 import re
-import sys
 import subprocess
 import itertools
 
-import framework.grouptools as grouptools
-import framework.core
+from framework import grouptools, exceptions, core
 from framework.profile import TestProfile, Test
 
 __all__ = ['profile']
 
-X_TEST_SUITE = framework.core.PIGLIT_CONFIG.get('xts', 'path')
+X_TEST_SUITE = core.PIGLIT_CONFIG.required_get('xts', 'path')
 
 
 class XTSProfile(TestProfile):  # pylint: disable=too-few-public-methods
@@ -198,7 +196,6 @@  def _populate_profile():
 
 
 if not os.path.exists(X_TEST_SUITE):
-    print("Error: xtest not found.", file=sys.stderr)
-    sys.exit(1)
+    raise exceptions.PiglitFatalError('XTest suite not found.')
 
 profile = _populate_profile()  # pylint: disable=invalid-name