Skip to content

Commit

Permalink
wip3
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Dec 16, 2023
1 parent 31b2694 commit 6353598
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions tests_python/test_frame_eval_and_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from contextlib import contextmanager
from tests_python.debugger_unittest import IS_PY36_OR_GREATER, IS_CPYTHON
from tests_python.debug_constants import TEST_CYTHON, TODO_PY311
from _pydevd_bundle.pydevd_constants import IS_PY312_OR_GREATER

pytest_plugins = [
str('tests_python.debugger_fixtures'),
Expand Down Expand Up @@ -58,7 +59,10 @@ def test_step_and_resume(case_setup_force_frame_eval):

assert hit.line == 2
# we enable frame evaluation debugger after "Resume" command
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_run_thread(hit.thread_id)

Expand All @@ -72,7 +76,10 @@ def test_step_return(case_setup_force_frame_eval):

hit = writer.wait_for_breakpoint_hit()

assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"
writer.write_get_frame(hit.thread_id, hit.frame_id)

writer.write_step_return(hit.thread_id)
Expand Down Expand Up @@ -154,7 +161,10 @@ def test_add_exc_break_while_running(case_setup_force_frame_eval):

assert hit.line == 10
# we use tracing debugger if there are exception breakpoints
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_add_exception_breakpoint_with_policy('IndexError', "1", "0", "0")

Expand All @@ -164,7 +174,10 @@ def test_add_exc_break_while_running(case_setup_force_frame_eval):

assert hit.line == 2
# we use tracing debugger if exception break was added
assert hit.suspend_type == "trace"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "trace"

writer.write_run_thread(hit.thread_id)

Expand All @@ -180,7 +193,10 @@ def test_add_termination_exc_break(case_setup_force_frame_eval):
hit = writer.wait_for_breakpoint_hit(line=10)

# we can use frame evaluation with exception breakpoint with "On termination" suspend policy
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_run_thread(hit.thread_id)

Expand All @@ -197,7 +213,10 @@ def test_frame_eval_whitebox_test(case_setup_force_frame_eval):
writer.write_make_initial_run()

hit = writer.wait_for_breakpoint_hit(line=line_on_global)
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_step_over(hit.thread_id)
hit = writer.wait_for_breakpoint_hit(reason=CMD_STEP_OVER)
Expand Down Expand Up @@ -225,7 +244,10 @@ def test_frame_eval_change_breakpoints(case_setup_force_frame_eval):
writer.write_make_initial_run()

hit = writer.wait_for_breakpoint_hit(line=break2_line)
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_remove_breakpoint(break2_id)
writer.write_add_breakpoint(break1_line, 'None')
Expand Down Expand Up @@ -271,7 +293,10 @@ def test_break_line_1(case_setup_force_frame_eval):
writer.write_make_initial_run()

hit = writer.wait_for_breakpoint_hit(line=break1_line)
assert hit.suspend_type == "frame_eval"
if IS_PY312_OR_GREATER:
assert hit.suspend_type == "sys_monitor"
else:
assert hit.suspend_type == "frame_eval"

writer.write_run_thread(hit.thread_id)

Expand Down

0 comments on commit 6353598

Please sign in to comment.