Skip to content

Commit

Permalink
🎨 Multiprocess breakpoint support code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
michprev committed Oct 2, 2024
1 parent 5bfbe44 commit 866d9ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 0 additions & 4 deletions wake-coverage.cov

This file was deleted.

13 changes: 7 additions & 6 deletions wake/testing/custom_pdb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from IPython.terminal.debugger import TerminalPdb
from typing import Any

from IPython.terminal.debugger import TerminalPdb


class CustomPdb(TerminalPdb):
def __init__(self, program_instance, *args, **kwargs):
"""
Expand All @@ -15,7 +17,7 @@ def do_continue(self, arg):
"""
self.cleanup_before_exit()
return super().do_continue(arg)

do_c = do_cont = do_continue

def do_quit(self, arg):
Expand All @@ -24,13 +26,12 @@ def do_quit(self, arg):
"""
self.cleanup_before_exit()
return super().do_quit(arg)
do_q = do_exit = do_quit

do_q = do_exit = do_quit

def cleanup_before_exit(self):
"""
This function performs the cleanup before exiting the debugger.
"""
print("Performing cleanup before exiting the debugger...")
self._program_instance._setup_stdio()
self._program_instance._conn.send(("breakpoint_handled",))
self._program_instance._conn.send(("breakpoint_handled",))
4 changes: 2 additions & 2 deletions wake/testing/pytest_plugin_multiprocess_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ def pytest_runtestloop(self, session: pytest.Session):

console.print(syntax)
console.print(
f"Process #{index} reach breakpoint in {function_name} at {filename}:{lineno}."
f"Process #{index} reached breakpoint in {function_name} at {filename}:{lineno}."
)

attach = None
while attach is None:
response = input(
"Would you like to attach the debugger? [y/n] ('n' to continue operations) "
"Would you like to attach the debugger? ('n' to continue operations) [y/n] "
)
if response == "y":
attach = True
Expand Down

0 comments on commit 866d9ec

Please sign in to comment.