[Piglit] [PATCH 05/16] tests/xts.py: use new error handling.

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 21 15:44:22 PDT 2015


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 at intel.com>
---
 framework/tests/integration_tests.py | 7 +++----
 tests/xts.py                         | 9 +++------
 2 files changed, 6 insertions(+), 10 deletions(-)

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
-- 
2.3.5



More information about the Piglit mailing list