Skip to content

Commit f44ea3f

Browse files
committed
python format
1 parent 5c1d185 commit f44ea3f

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def build_and_create_debug_adapter_for_attach(self):
4949
self.build_and_create_debug_adapter(dictionary={"EXE": unique_name})
5050
return self.getBuildArtifact(unique_name)
5151

52-
def set_source_breakpoints(self, source_path, lines, data=None, wait_for_resolve=True):
52+
def set_source_breakpoints(
53+
self, source_path, lines, data=None, wait_for_resolve=True
54+
):
5355
"""Sets source breakpoints and returns an array of strings containing
5456
the breakpoint IDs ("1", "2") for each breakpoint that was set.
5557
Parameter data is array of data objects for breakpoints.
@@ -83,7 +85,9 @@ def set_source_breakpoints_assembly(self, source_reference, lines, data=None):
8385
breakpoint_ids.append("%i" % (breakpoint["id"]))
8486
return breakpoint_ids
8587

86-
def set_function_breakpoints(self, functions, condition=None, hitCondition=None, wait_for_resolve=True):
88+
def set_function_breakpoints(
89+
self, functions, condition=None, hitCondition=None, wait_for_resolve=True
90+
):
8791
"""Sets breakpoints by function name given an array of function names
8892
and returns an array of strings containing the breakpoint IDs
8993
("1", "2") for each breakpoint that was set.
@@ -100,24 +104,36 @@ def set_function_breakpoints(self, functions, condition=None, hitCondition=None,
100104
if wait_for_resolve:
101105
self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)
102106
return breakpoint_ids
103-
104-
def wait_for_breakpoints_to_resolve(self, breakpoint_ids: list[str], timeout: Optional[float] = None):
107+
108+
def wait_for_breakpoints_to_resolve(
109+
self, breakpoint_ids: list[str], timeout: Optional[float] = None
110+
):
105111
unresolved_breakpoints = set(breakpoint_ids)
106-
112+
107113
# Check already resolved breakpoints
108-
resolved_breakpoints = self.dap_server.request_testGetTargetBreakpoints(only_resolved=True)["body"]["breakpoints"]
114+
resolved_breakpoints = self.dap_server.request_testGetTargetBreakpoints(
115+
only_resolved=True
116+
)["body"]["breakpoints"]
109117
for resolved_breakpoint in resolved_breakpoints:
110118
unresolved_breakpoints.discard(str(resolved_breakpoint["id"]))
111119

112120
while len(unresolved_breakpoints) > 0:
113-
breakpoint_event = self.dap_server.wait_for_event("breakpoint", timeout=timeout)
121+
breakpoint_event = self.dap_server.wait_for_event(
122+
"breakpoint", timeout=timeout
123+
)
114124
if breakpoint_event is None:
115125
break
116126

117127
if breakpoint_event["body"]["reason"] in ["changed", "new"]:
118-
unresolved_breakpoints.discard(str(breakpoint_event["body"]["breakpoint"]["id"]))
128+
unresolved_breakpoints.discard(
129+
str(breakpoint_event["body"]["breakpoint"]["id"])
130+
)
119131

120-
self.assertEqual(len(unresolved_breakpoints), 0, f"Expected to resolve all breakpoints. Unresolved breakpoint ids: {unresolved_breakpoints}")
132+
self.assertEqual(
133+
len(unresolved_breakpoints),
134+
0,
135+
f"Expected to resolve all breakpoints. Unresolved breakpoint ids: {unresolved_breakpoints}",
136+
)
121137

122138
def waitUntil(self, condition_callback):
123139
for _ in range(20):

lldb/test/API/tools/lldb-dap/module/TestDAP_module.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ def run_test(self, symbol_basename, expect_debug_info_size):
1616
program = self.getBuildArtifact(program_basename)
1717
self.build_and_launch(program)
1818
functions = ["foo"]
19-
19+
2020
# This breakpoint will be resolved only when the libfoo module is loaded
21-
breakpoint_ids = self.set_function_breakpoints(functions, wait_for_resolve=False)
21+
breakpoint_ids = self.set_function_breakpoints(
22+
functions, wait_for_resolve=False
23+
)
2224
self.assertEqual(len(breakpoint_ids), len(functions), "expect one breakpoint")
2325
self.continue_to_breakpoints(breakpoint_ids)
2426
active_modules = self.dap_server.get_modules()

lldb/test/API/tools/lldb-dap/terminated-event/TestDAP_terminatedEvent.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ def test_terminated_event(self):
3535
self.build_and_launch(program)
3636
# Set breakpoints
3737
functions = ["foo"]
38-
38+
3939
# This breakpoint will be resolved only when the libfoo module is loaded
40-
breakpoint_ids = self.set_function_breakpoints(functions, wait_for_resolve=False)
40+
breakpoint_ids = self.set_function_breakpoints(
41+
functions, wait_for_resolve=False
42+
)
4143
self.assertEqual(len(breakpoint_ids), len(functions), "expect one breakpoint")
4244
main_bp_line = line_number("main.cpp", "// main breakpoint 1")
43-
breakpoint_ids.append(self.set_source_breakpoints("main.cpp", [main_bp_line], wait_for_resolve=False))
45+
breakpoint_ids.append(
46+
self.set_source_breakpoints(
47+
"main.cpp", [main_bp_line], wait_for_resolve=False
48+
)
49+
)
4450

4551
self.continue_to_breakpoints(breakpoint_ids)
4652
self.continue_to_exit()

0 commit comments

Comments
 (0)