From a4c18137d84bc48df49ee0101bef465a955e62ac Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 28 Jun 2024 20:08:53 +0100 Subject: [lldb][test] Remove duplicate testcase names in API test-suite (#97043) In one of my recent PRs I mistakenly had two test-cases with the same name, preventing one of them to run. Since it's an easy mistake to make (e.g., copy pasting existing test-cases), I ran following sanity-check script over `lldb/test/API`, which found couple of tests which were losing coverage because of this (or in some cases simply had duplicate tests): ``` import ast import sys filename = sys.argv[1] print(f'Checking {filename}...') tree = ast.parse(open(filename, 'r').read()) for node in ast.walk(tree): if not isinstance(node, ast.ClassDef): continue func_names = [] for child in ast.iter_child_nodes(node): if isinstance(child, ast.FunctionDef): func_names.append(child.name) seen_func_names = set() duplicate_func_names = [] for name in func_names: if name in seen_func_names: duplicate_func_names.append(name) else: seen_func_names.add(name) if len(duplicate_func_names) != 0: print(f'Multiple func names found:\n\t{duplicate_func_names}\n\tclass {node.name}\n\tfile: {filename}') ``` This patch fixes these cases. --- .../API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/test/API/functionalities/plugins/python_os_plugin') diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 859e87cf75a5..e03e8e0df778 100644 --- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -17,7 +17,7 @@ class PluginPythonOSPlugin(TestBase): self.build() self.run_python_os_funcionality() - def run_python_os_step(self): + def test_run_python_os_step(self): """Test that the Python operating system plugin works correctly when single stepping a virtual thread""" self.build() self.run_python_os_step() -- cgit v1.2.3