Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbe784b

Browse filesBrowse files
committed
More tests
1 parent 205bc55 commit bbe784b
Copy full SHA for bbe784b

File tree

Expand file treeCollapse file tree

1 file changed

+11
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-8
lines changed

‎Lib/test/test_remote_pdb.py

Copy file name to clipboardExpand all lines: Lib/test/test_remote_pdb.py
+11-8Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _create_script(self, script=None):
264264
def foo():
265265
x = 42
266266
return bar()
267-
267+
268268
def bar():
269269
return 42
270270
@@ -311,13 +311,13 @@ def _connect_and_get_client_file(self):
311311
stderr=subprocess.PIPE,
312312
text=True
313313
)
314-
314+
315315
# Accept the connection from the subprocess
316316
client_sock, _ = self.server_sock.accept()
317317
client_file = client_sock.makefile('rwb')
318318
self.addCleanup(client_file.close)
319319
self.addCleanup(client_sock.close)
320-
320+
321321
return process, client_file
322322

323323
def _read_until_prompt(self, client_file):
@@ -337,7 +337,7 @@ def _send_command(self, client_file, command):
337337
"""Helper to send a command to the debugger."""
338338
client_file.write(json.dumps({"reply": command}).encode() + b"\n")
339339
client_file.flush()
340-
340+
341341
def _send_interrupt(self, pid):
342342
"""Helper to send an interrupt signal to the debugger."""
343343
# with tempfile.NamedTemporaryFile("w", delete_on_close=False) as interrupt_script:
@@ -349,7 +349,10 @@ def _send_interrupt(self, pid):
349349
'if inst := pdb.Pdb._last_pdb_instance:\n'
350350
' inst.set_trace(sys._getframe(1))\n'
351351
)
352-
sys.remote_exec(pid, interrupt_script)
352+
try:
353+
sys.remote_exec(pid, interrupt_script)
354+
except PermissionError:
355+
self.skipTest("Insufficient permissions to execute code in remote process")
353356
self.addCleanup(unlink, interrupt_script)
354357

355358
def test_connect_and_basic_commands(self):
@@ -380,9 +383,9 @@ def test_connect_and_basic_commands(self):
380383

381384
# Check for response - we should get some stack frames
382385
messages = self._read_until_prompt(client_file)
383-
386+
384387
# Extract text messages containing stack info
385-
text_msg = [msg['message'] for msg in messages
388+
text_msg = [msg['message'] for msg in messages
386389
if 'message' in msg and 'connect_to_debugger' in msg['message']]
387390
got_stack_info = bool(text_msg)
388391

@@ -423,7 +426,7 @@ def test_breakpoints(self):
423426
# Continue execution until breakpoint
424427
self._send_command(client_file, "c")
425428
messages = self._read_until_prompt(client_file)
426-
429+
427430
# Verify we hit the breakpoint
428431
hit_msg = next(msg['message'] for msg in messages if 'message' in msg)
429432
self.assertIn("bar()", hit_msg)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.