(pyfile, target, run)
| 575 | |
| 576 | |
| 577 | def test_set_expression(pyfile, target, run): |
| 578 | @pyfile |
| 579 | def code_to_debug(): |
| 580 | import debuggee |
| 581 | from debuggee import backchannel |
| 582 | |
| 583 | debuggee.setup() |
| 584 | a = 1 |
| 585 | backchannel.send(a) # @bp |
| 586 | |
| 587 | with debug.Session() as session: |
| 588 | backchannel = session.open_backchannel() |
| 589 | with run(session, target(code_to_debug)): |
| 590 | session.set_breakpoints(code_to_debug, all) |
| 591 | |
| 592 | stop = session.wait_for_stop() |
| 593 | scopes = session.request("scopes", {"frameId": stop.frame_id})["scopes"] |
| 594 | globals_ref = scopes[0]["variablesReference"] |
| 595 | |
| 596 | vars = session.request("variables", {"variablesReference": globals_ref})[ |
| 597 | "variables" |
| 598 | ] |
| 599 | (a,) = (v for v in vars if v["name"] == "a") |
| 600 | assert a == some.dict.containing( |
| 601 | { |
| 602 | "type": "int", |
| 603 | "value": "1", |
| 604 | "name": "a", |
| 605 | "evaluateName": "a", |
| 606 | "variablesReference": 0, |
| 607 | } |
| 608 | ) |
| 609 | |
| 610 | set_a = session.request( |
| 611 | "setExpression", |
| 612 | {"frameId": stop.frame_id, "expression": "a", "value": "1000"}, |
| 613 | ) |
| 614 | assert set_a == some.dict.containing({"type": "int", "value": "1000"}) |
| 615 | |
| 616 | session.request_continue() |
| 617 | assert backchannel.receive() == 1000 |
| 618 | |
| 619 | |
| 620 | def test_evaluate_thread_locks(pyfile, target, run): |
nothing calls this directly
no test coverage detected
searching dependent graphs…