[Piglit] [PATCH 12/20] dmesg_tests.py: Promote some helpers to toplevel classes

Dylan Baker baker.dylan.c at gmail.com
Sat Jun 14 08:05:21 PDT 2014


Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/tests/dmesg_tests.py | 45 ++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index 38d158b..ced3d9a 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -61,6 +61,30 @@ def _write_dev_kmesg():
         raise SkipTest("Writing to the ringbuffer failed")
 
 
+class DummyJsonWriter(object):
+    """ A very simple dummy for json writer """
+    def __init__(self):
+        pass
+
+    def write_dict_item(self, path, result):
+        self.result = result
+
+
+class DummyLog(object):
+    """ A very smiple dummy for the Logger """
+    def __init__(self):
+        pass
+
+    def pre_log(self, *args):
+        return None
+
+    def log(self, *args):
+        pass
+
+    def post_log(self, *args):
+        pass
+
+
 def test_linux_initialization():
     """ Test that LinuxDmesg initializes """
     LinuxDmesg()
@@ -289,27 +313,6 @@ def check_classes_dmesg(test_class, test_args):
         raise SkipTest("This tests requires a working, built version of "
                        "piglit")
 
-    class DummyJsonWriter(object):
-        """ A very simple dummy for json writer """
-        def __init__(self):
-            pass
-
-        def write_dict_item(self, path, result):
-            self.result = result
-
-    class DummyLog(object):
-        def __init__(self):
-            pass
-
-        def pre_log(self, *args):
-            return None
-
-        def log(self, *args):
-            pass
-
-        def post_log(self, *args):
-            pass
-
     def _write_dmesg():
         """ Small helper to write dmesg """
         subprocess.call(['sudo', 'sh', '-c', 'echo "piglit test" > /dev/kmsg'])
-- 
2.0.0



More information about the Piglit mailing list