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

Function test_case_suspend_thread

tests_python/test_debugger.py:310–342  ·  view source on GitHub ↗
(case_setup)

Source from the content-addressed store, hash-verified

308
309
310def test_case_suspend_thread(case_setup):
311 with case_setup.test_file("_debugger_case4.py") as writer:
312 writer.write_make_initial_run()
313
314 thread_id = writer.wait_for_new_thread()
315
316 writer.write_suspend_thread(thread_id)
317
318 while True:
319 hit = writer.wait_for_breakpoint_hit((REASON_THREAD_SUSPEND, REASON_STOP_ON_BREAKPOINT))
320 if hit.name == "sleep":
321 break # Ok, broke on 'sleep'.
322 else:
323 # i.e.: if it doesn't hit on 'sleep', release and pause again.
324 writer.write_run_thread(thread_id)
325 time.sleep(0.1)
326 writer.write_suspend_thread(thread_id)
327
328 assert hit.thread_id == thread_id
329
330 writer.write_evaluate_expression("%s\t%s\t%s" % (hit.thread_id, hit.frame_id, "LOCAL"), "exit_while_loop()")
331 writer.wait_for_evaluation(
332 [
333 [
334 '<var name="exit_while_loop()" type="str" qualifier="{0}" value="str: ok'.format(builtin_qualifier),
335 '<var name="exit_while_loop()" type="str" value="str: ok"', # jython
336 ]
337 ]
338 )
339
340 writer.write_run_thread(thread_id)
341
342 writer.finished_ok = True
343
344
345# Jython has a weird behavior: it seems it has fine-grained locking so that when

Callers

nothing calls this directly

Calls 7

test_fileMethod · 0.80
wait_for_new_threadMethod · 0.80
write_suspend_threadMethod · 0.80
write_run_threadMethod · 0.80

Tested by

no test coverage detected