MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_step_out_multi_threads

Function test_step_out_multi_threads

tests_python/test_debugger_json.py:3322–3362  ·  view source on GitHub ↗
(case_setup_dap, stepping_resumes_all_threads)

Source from the content-addressed store, hash-verified

3320
3321@pytest.mark.parametrize("stepping_resumes_all_threads", [False, True])
3322def 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])

Callers

nothing calls this directly

Calls 12

write_launchMethod · 0.95
write_set_breakpointsMethod · 0.95
write_list_threadsMethod · 0.95
write_step_outMethod · 0.95
write_step_nextMethod · 0.95
write_continueMethod · 0.95
JsonFacadeClass · 0.85
test_fileMethod · 0.80
set_messages_timeoutMethod · 0.80

Tested by

no test coverage detected