[Piglit] [PATCH 03/35] framework/profile: Allow a group manager class to be overwritten

Dylan Baker dylan at pnwbakers.com
Wed Apr 4 22:26:51 UTC 2018


This is useful for classes like the coming BuiltInConstantsTest class,
where just one or two tests need to change the test class.
---
 framework/profile.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index d77ac09..b6deed0 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -205,7 +205,7 @@ class TestDict(collections.MutableMapping):
         """
         assert isinstance(group, six.string_types), type(group)
 
-        def adder(args, name=None, **kwargs):
+        def adder(args, name=None, override_class=None, **kwargs):
             """Helper function that actually adds the tests.
 
             Arguments:
@@ -228,7 +228,9 @@ class TestDict(collections.MutableMapping):
             assert isinstance(name, six.string_types)
             lgroup = grouptools.join(group, name)
 
-            self[lgroup] = test_class(
+            class_ = override_class or test_class
+
+            self[lgroup] = class_(
                 args,
                 **dict(itertools.chain(six.iteritems(default_args),
                                        six.iteritems(kwargs))))
-- 
git-series 0.9.1


More information about the Piglit mailing list