(case_setup)
| 308 | |
| 309 | |
| 310 | def 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 |
nothing calls this directly
no test coverage detected