]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pytest: dynamic tests optionally add __doc__
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 5 Aug 2021 23:08:10 +0000 (11:08 +1200)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Oct 2021 22:37:10 +0000 (22:37 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14869
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14881

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit aacb18f920349e13b562c7c97901a0be7b273137)

python/samba/tests/__init__.py

index 38f65f17e35e0da3317b93fac4e32e800316ba44..d895802c34f099d5e517763e626b4a48e8f020b1 100644 (file)
@@ -71,7 +71,7 @@ class TestCase(unittest.TestCase):
     """A Samba test case."""
 
     @classmethod
-    def generate_dynamic_test(cls, fnname, suffix, *args):
+    def generate_dynamic_test(cls, fnname, suffix, *args, doc=None):
         """
         fnname is something like "test_dynamic_sum"
         suffix is something like "1plus2"
@@ -84,6 +84,7 @@ class TestCase(unittest.TestCase):
         """
         def fn(self):
             getattr(self, "_%s_with_args" % fnname)(*args)
+        fn.__doc__ = doc
         setattr(cls, "%s_%s" % (fnname, suffix), fn)
 
     @classmethod