From: Jouni Malinen Date: Sun, 17 Mar 2024 13:20:26 +0000 (+0200) Subject: tests: Verify test case function documentation X-Git-Tag: hostap_2_11~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caf0cda761d4e177da7da6c42ca8ff013a96262f;p=thirdparty%2Fhostap.git tests: Verify test case function documentation Check that each test case function includes a title in __doc__ and also verify that the same test case is not added multiple times from different files. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 1fdd923c4..3c0502002 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -231,6 +231,7 @@ def get_test_description(t): def main(): tests = [] test_modules = [] + names = set() files = os.listdir(scriptsdir) for t in files: m = re.match(r'(test_.*)\.py$', t) @@ -240,8 +241,15 @@ def main(): test_modules.append(mod.__name__.replace('test_', '', 1)) for key, val in mod.__dict__.items(): if key.startswith("test_"): + if val.__doc__ is None: + print(f"Test case {val.__name__} misses __doc__") tests.append(val) - test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests])) + + name = val.__name__.replace('test_', '', 1) + if name in names: + print(f"Test case {name} defined multiple times") + names.add(name) + test_names = list(names) run = None