Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Dec 16, 2023
1 parent ee1b1fd commit 31b2694
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests_python/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3692,7 +3692,6 @@ def test_step_return_my_code(case_setup):
writer.finished_ok = True


@pytest.mark.skipif(TODO_PY311, reason='Needs bytecode support in Python 3.11')
def test_smart_step_into_case1(case_setup):
with case_setup.test_file('_debugger_case_smart_step_into.py') as writer:
line = writer.get_line_index_with_content('break here')
Expand All @@ -3703,8 +3702,19 @@ def test_smart_step_into_case1(case_setup):
found = writer.get_step_into_variants(hit.thread_id, hit.frame_id, line, line)

# Remove the offset/childOffset to compare (as it changes for each python version)
assert [x[:-2] for x in found] == [
('bar', 'false', '14', '1'), ('foo', 'false', '14', '1'), ('call_outer', 'false', '14', '1')]
found_info = [x[:-2] for x in found]
if IS_PY311_OR_GREATER:
assert found_info == [
('bar()', 'false', '14', '1'),
('foo(bar())', 'false', '14', '1'),
('call_outer(foo(bar()))', 'false', '14', '1'),
]
else:
assert found_info == [
('bar', 'false', '14', '1'),
('foo', 'false', '14', '1'),
('call_outer', 'false', '14', '1')
]

# Note: this is just using the name, not really taking using the context.
writer.write_smart_step_into(hit.thread_id, line, 'foo')
Expand All @@ -3715,7 +3725,6 @@ def test_smart_step_into_case1(case_setup):
writer.finished_ok = True


@pytest.mark.skipif(TODO_PY311, reason='Needs bytecode support in Python 3.11')
def test_smart_step_into_case2(case_setup):
with case_setup.test_file('_debugger_case_smart_step_into2.py') as writer:
line = writer.get_line_index_with_content('break here')
Expand Down Expand Up @@ -3744,7 +3753,6 @@ def test_smart_step_into_case2(case_setup):
writer.finished_ok = True


@pytest.mark.skipif(TODO_PY311, reason='Needs bytecode support in Python 3.11')
def test_smart_step_into_case3(case_setup):
with case_setup.test_file('_debugger_case_smart_step_into3.py') as writer:
line = writer.get_line_index_with_content('break here')
Expand All @@ -3760,10 +3768,10 @@ def test_smart_step_into_case3(case_setup):
OFFSET_POS = 4
CHILD_OFFSET_POS = 5

f = [x for x in found if x[NAME_POS] == 'foo']
f = [x for x in found if x[NAME_POS] in ('foo', 'foo(arg)')] # Python 3.11 uses foo(arg)
assert len(f) == 1

writer.write_smart_step_into(hit.thread_id, 'offset=' + f[0][OFFSET_POS] + ';' + f[0][CHILD_OFFSET_POS], 'foo')
writer.write_smart_step_into(hit.thread_id, 'offset=' + f[0][OFFSET_POS] + ';' + f[0][CHILD_OFFSET_POS], f[0][NAME_POS])
hit = writer.wait_for_breakpoint_hit(reason=CMD_SMART_STEP_INTO)
assert hit.line == writer.get_line_index_with_content('on foo mark')

Expand Down

0 comments on commit 31b2694

Please sign in to comment.