[Piglit] [PATCH 2/7] framework/tests: replace custom decorator with nose's attr decorator

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Thu Oct 8 14:49:42 PDT 2015


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

This is a more standard way to mark tests out as special case, and not
rolling our own code is good.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/dmesg_tests.py |  7 ++++---
 framework/tests/utils.py       | 12 ------------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index 618994c..8ef7e0e 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -36,6 +36,7 @@ except ImportError:
     import json
 import nose.tools as nt
 from nose.plugins.skip import SkipTest
+from nose.plugins.attrib import attr
 
 from framework import dmesg, status
 import framework.core
@@ -150,7 +151,7 @@ def test_get_dmesg_linux():
                       "but it actually returned {}".format(type(posix))))
 
 
- at utils.privileged_test
+ at attr('privliged')
 def test_update_dmesg_with_updates():
     """dmesg.Dmesg.update_dmesg(): updates results when there is a new entry in dmesg
 
@@ -172,7 +173,7 @@ def test_update_dmesg_with_updates():
                              "has been updated.".format(test.__class__)))
 
 
- at utils.privileged_test
+ at attr('privliged')
 def test_update_dmesg_without_updates():
     """dmesg.Dmesg.update_dmesg(): does not update results when there is no change in dmesg
 
@@ -381,7 +382,7 @@ def test_json_serialize_updated_result():
     encoder.encode(result)
 
 
- at privileged_generator
+ at attr('privliged')
 def test_testclasses_dmesg():
     """ Generator that creates tests for """
     lists = [(framework.test.PiglitGLTest, ['attribs'], 'PiglitGLTest'),
diff --git a/framework/tests/utils.py b/framework/tests/utils.py
index 6ad2ff0..2a9370c 100644
--- a/framework/tests/utils.py
+++ b/framework/tests/utils.py
@@ -292,18 +292,6 @@ def nose_generator(func):
     return test_wrapper
 
 
-def privileged_test(func):
-    """ Wrapper to name the tests as sudo
-
-    This makes the name of the function contain begin with sudo, which is
-    useful for excluding tests with privileged execution requirements
-
-    """
-    func.__name__ = 'sudo_' + func.__name__
-
-    return func
-
-
 def binary_check(bin_, errno_=None):
     """Check for the existance of a binary or raise SkipTest.
 
-- 
2.6.1



More information about the Piglit mailing list