]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Optimize run-tests.py test case dict iteration
authorJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 18:08:11 +0000 (20:08 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 18:08:11 +0000 (20:08 +0200)
Use a single iteration through the module dictionary rather than
iterating over the keys and separately fetching values to get the
function.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/run-tests.py

index 538b9ac5e6199eef0e20bcada9f92d8daa62614a..a4f768806894d298c3b25d7de463e21d7c91bff5 100755 (executable)
@@ -161,10 +161,9 @@ def main():
             logger.debug("Import test cases from " + t)
             mod = __import__(m.group(1))
             test_modules.append(mod.__name__.replace('test_', '', 1))
-            for s in dir(mod):
-                if s.startswith("test_"):
-                    func = mod.__dict__.get(s)
-                    tests.append(func)
+            for key,val in mod.__dict__.iteritems():
+                if key.startswith("test_"):
+                    tests.append(val)
     test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
 
     run = None