From 31b26942e9bba0f91acc931f6aacc02a47e27ea3 Mon Sep 17 00:00:00 2001 From: Fabio Zadrozny Date: Sat, 16 Dec 2023 17:00:29 -0300 Subject: [PATCH] wip --- tests_python/test_debugger.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests_python/test_debugger.py b/tests_python/test_debugger.py index 26531940..2cb1b01e 100644 --- a/tests_python/test_debugger.py +++ b/tests_python/test_debugger.py @@ -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') @@ -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') @@ -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') @@ -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') @@ -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')