[Piglit] [PATCH 4/6] dmesg.py: Remove DmesgError.

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Mon Nov 23 22:01:11 PST 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

This exception predates the exceptions module. The only instance of this
error is used in a place where piglit should stop because it cannot
continue, which is what PiglitFatalError is for.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/dmesg.py             |  8 +++-----
 framework/tests/dmesg_tests.py | 10 +++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/framework/dmesg.py b/framework/dmesg.py
index 70395d8..f44d4a8 100644
--- a/framework/dmesg.py
+++ b/framework/dmesg.py
@@ -43,6 +43,8 @@ import warnings
 import abc
 import gzip
 
+from framework import exceptions
+
 __all__ = [
     'BaseDmesg',
     'LinuxDmesg',
@@ -188,7 +190,7 @@ class LinuxDmesg(BaseDmesg):
             # Do an initial check to ensure that dmesg has timestamps, we need
             # timestamps to work correctly. A proper linux dmesg timestamp
             # looks like this: [    0.00000]
-            raise DmesgError(
+            raise exceptions.PiglitFatalError(
                 "Your kernel does not seem to support timestamps, which "
                 "are required by the --dmesg option")
 
@@ -237,10 +239,6 @@ class DummyDmesg(BaseDmesg):
         return result
 
 
-class DmesgError(EnvironmentError):
-    pass
-
-
 def get_dmesg(not_dummy=True):
     """ Return a Dmesg type instance
 
diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index 0a6d367..97419e9 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -33,7 +33,7 @@ import mock
 import nose.tools as nt
 
 from . import utils
-from framework import dmesg, status, results
+from framework import dmesg, status, results, exceptions
 
 # pylint: disable=invalid-name,line-too-long,attribute-defined-outside-init
 
@@ -190,7 +190,7 @@ def test_linuxdmesg_gzip_errors():
     config.gz.
 
     """
-    exceptions = {
+    exceptions_ = {
         OSError,
         IOError,
     }
@@ -204,15 +204,15 @@ def test_linuxdmesg_gzip_errors():
                 with warnings.catch_warnings():
                     warnings.simplefilter('error')
                     dmesg.LinuxDmesg()
-        except (dmesg.DmesgError, RuntimeWarning):
+        except (exceptions.PiglitFatalError, RuntimeWarning):
             pass
 
-    for exception in exceptions:
+    for exception in exceptions_:
         test.description = description.format(exception.__name__)
         yield test, exception
 
 
- at nt.raises(dmesg.DmesgError)
+ at nt.raises(exceptions.PiglitFatalError)
 @mock.patch('framework.dmesg.gzip.open', mock.Mock(side_effect=IOError))
 def test_linuxdmesg_timestamp():
     """dmesg.LinuxDmesg: If timestamps are not detected raise"""
-- 
2.6.2



More information about the Piglit mailing list