Skip to content

Commit

Permalink
✏️ fix sdtout bug when user select not to enter debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
MeditationDuck committed Sep 17, 2024
1 parent dcd9346 commit 46d4adc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions wake/testing/custom_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ 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.exit_debugger()
6 changes: 5 additions & 1 deletion wake/testing/pytest_plugin_multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ def pytest_exception_interact(self, node, call, report):
self._exception_handler(
call.excinfo.type, call.excinfo.value, call.excinfo.tb
)

def exit_debugger(self):
self._setup_stdio()
self._conn.send(("breakpoint_handled",))

def pytest_runtestloop(self, session: Session):
if (
Expand Down Expand Up @@ -192,7 +196,7 @@ def custom_debugger():
p.set_trace(frame)
else:
# trace nothing, same as continue
self._conn.send(("breakpoint_handled",))
self.exit_debugger()

sys.breakpointhook = custom_debugger

Expand Down
2 changes: 1 addition & 1 deletion wake/testing/pytest_plugin_multiprocess_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def pytest_runtestloop(self, session: pytest.Session):
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? [y/n] "
)
if response == "y":
attach = True
Expand Down

0 comments on commit 46d4adc

Please sign in to comment.