mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
pytest: dynamic tests optionally add __doc__
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14869 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
6292f0597f
commit
aacb18f920
@ -68,7 +68,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"
|
||||
@ -81,6 +81,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user