Skip to content

Commit 28e5992

Browse files
committed
DEBUGGING
Signed-off-by: Pablo Galindo <[email protected]>
1 parent 659556f commit 28e5992

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

Lib/test/test_remote_pdb.py

+30-19
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def _read_until_prompt(self, client_file):
328328
if not data:
329329
break
330330
msg = json.loads(data.decode())
331+
print(msg)
331332
messages.append(msg)
332333
if 'prompt' in msg:
333334
break
@@ -482,27 +483,37 @@ def bar():
482483

483484
with process:
484485

485-
# Skip initial messages until we get to the prompt
486-
self._read_until_prompt(client_file)
487-
488-
# Continue execution
489-
self._send_command(client_file, "c")
490-
491-
# Send keyboard interrupt signal
492-
self._send_command(client_file, json.dumps({"signal": "INT"}))
493-
self._send_interrupt(process.pid)
494-
messages = self._read_until_prompt(client_file)
486+
try:
495487

496-
# Verify we got the keyboard interrupt message
497-
interrupt_msg = next(msg['message'] for msg in messages if 'message' in msg)
498-
self.assertIn("bar()", interrupt_msg)
488+
# Skip initial messages until we get to the prompt
489+
self._read_until_prompt(client_file)
499490

500-
# Continue to end
501-
self._send_command(client_file, "iterations = 0")
502-
self._send_command(client_file, "c")
503-
stdout, _ = process.communicate(timeout=5)
504-
self.assertIn("Function returned: 42", stdout)
505-
self.assertEqual(process.returncode, 0)
491+
# Continue execution
492+
self._send_command(client_file, "c")
493+
494+
# Send keyboard interrupt signal
495+
self._send_interrupt(process.pid)
496+
messages = self._read_until_prompt(client_file)
497+
print(messages)
498+
print(process.stdout.readline())
499+
print(process.returncode)
500+
501+
# Verify we got the keyboard interrupt message
502+
interrupt_msg = next(msg['message'] for msg in messages if 'message' in msg)
503+
self.assertIn("bar()", interrupt_msg)
504+
505+
# Continue to end
506+
self._send_command(client_file, "iterations = 0")
507+
self._send_command(client_file, "c")
508+
stdout, _ = process.communicate(timeout=5)
509+
self.assertIn("Function returned: 42", stdout)
510+
self.assertEqual(process.returncode, 0)
511+
512+
except Exception as e:
513+
stdout, stderr = process.communicate(timeout=5)
514+
print(stderr)
515+
print(stdout)
516+
raise e from None
506517

507518
def test_handle_eof(self):
508519
"""Test that EOF signal properly exits the debugger."""

0 commit comments

Comments
 (0)