(case_setup_dap, stepping_resumes_all_threads)
| 3320 | |
| 3321 | @pytest.mark.parametrize("stepping_resumes_all_threads", [False, True]) |
| 3322 | def test_step_out_multi_threads(case_setup_dap, stepping_resumes_all_threads): |
| 3323 | with case_setup_dap.test_file("_debugger_case_multi_threads_stepping.py") as writer: |
| 3324 | json_facade = JsonFacade(writer) |
| 3325 | |
| 3326 | json_facade.write_launch(steppingResumesAllThreads=stepping_resumes_all_threads) |
| 3327 | json_facade.write_set_breakpoints( |
| 3328 | [ |
| 3329 | writer.get_line_index_with_content("Break thread 1"), |
| 3330 | ] |
| 3331 | ) |
| 3332 | json_facade.write_make_initial_run() |
| 3333 | |
| 3334 | json_hit = json_facade.wait_for_thread_stopped() |
| 3335 | |
| 3336 | response = json_facade.write_list_threads() |
| 3337 | assert len(response.body.threads) == 3 |
| 3338 | |
| 3339 | thread_name_to_id = dict((t["name"], t["id"]) for t in response.body.threads) |
| 3340 | assert json_hit.thread_id == thread_name_to_id["thread1"] |
| 3341 | |
| 3342 | if stepping_resumes_all_threads: |
| 3343 | # If we're stepping with multiple threads, we'll exit here. |
| 3344 | json_facade.write_step_out(thread_name_to_id["thread1"]) |
| 3345 | else: |
| 3346 | json_facade.write_step_out(thread_name_to_id["thread1"]) |
| 3347 | |
| 3348 | # Timeout is expected... make it shorter. |
| 3349 | writer.reader_thread.set_messages_timeout(2) |
| 3350 | try: |
| 3351 | json_hit = json_facade.wait_for_thread_stopped("step") |
| 3352 | raise AssertionError("Expected timeout!") |
| 3353 | except debugger_unittest.TimeoutError: |
| 3354 | pass |
| 3355 | |
| 3356 | json_facade.write_step_out(thread_name_to_id["thread2"]) |
| 3357 | json_facade.write_step_next(thread_name_to_id["MainThread"]) |
| 3358 | json_hit = json_facade.wait_for_thread_stopped("step") |
| 3359 | assert json_hit.thread_id == thread_name_to_id["MainThread"] or json_hit.thread_id == thread_name_to_id["thread2"] |
| 3360 | json_facade.write_continue() |
| 3361 | |
| 3362 | writer.finished_ok = True |
| 3363 | |
| 3364 | |
| 3365 | @pytest.mark.parametrize("stepping_resumes_all_threads", [True, False]) |
nothing calls this directly
no test coverage detected