Repository navigation
Commit 7d56ef8
test(workflow): run the invariant plugin in test modules that build a raw Runner
`InvariantPlugin` checks event/session invariants on every run, but it
only runs when a test goes through the shared test runners. Several
modules build a bare `Runner(...)` because they own the session service
or pass an `App`, so their runs were never checked.
Add `workflow_testing_utils.create_runner(**runner_kwargs,
check_invariants=True)`, which builds a `Runner` with the plugin
installed first (mirroring `TestInMemoryRunner`), and route the raw
sites through it:
- `test_workflow_dynamic_nodes.py` (24), `test_workflow_live.py` (6),
`test_workflow_rewind.py` (3), `test_workflow_agent_as_node.py` (2),
`test_workflow_function_tool_as_node.py` (1),
`test_node_runner_failure.py` (9, plus its local `_run_workflow` copy
is replaced by the shared `run_workflow`).
- `agents/test_llm_agent_interruptions.py` now uses
`TestInMemoryRunner` via a small `_make_runner` helper (4 sites).
46 previously unchecked runner sites now run under the plugin; all
migrated modules pass with no new invariant violations, so no opt-outs
were needed. Test-only change.
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 9959572071 parent b0ffa24 commit 7d56ef8
8 files changed
Lines changed: 91 additions & 106 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| |||
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
| |||
332 | 330 | | |
333 | 331 | | |
334 | 332 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 333 | + | |
343 | 334 | | |
344 | 335 | | |
345 | 336 | | |
| |||
398 | 389 | | |
399 | 390 | | |
400 | 391 | | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 392 | + | |
409 | 393 | | |
410 | 394 | | |
411 | 395 | | |
| |||
459 | 443 | | |
460 | 444 | | |
461 | 445 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 446 | + | |
470 | 447 | | |
471 | 448 | | |
472 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | 47 | | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 56 | | |
73 | 57 | | |
74 | 58 | | |
| |||
170 | 154 | | |
171 | 155 | | |
172 | 156 | | |
173 | | - | |
| 157 | + | |
174 | 158 | | |
175 | 159 | | |
176 | 160 | | |
| |||
364 | 348 | | |
365 | 349 | | |
366 | 350 | | |
367 | | - | |
| 351 | + | |
368 | 352 | | |
369 | 353 | | |
370 | 354 | | |
| |||
435 | 419 | | |
436 | 420 | | |
437 | 421 | | |
438 | | - | |
| 422 | + | |
439 | 423 | | |
440 | 424 | | |
441 | 425 | | |
| |||
563 | 547 | | |
564 | 548 | | |
565 | 549 | | |
566 | | - | |
| 550 | + | |
567 | 551 | | |
568 | 552 | | |
569 | 553 | | |
| |||
639 | 623 | | |
640 | 624 | | |
641 | 625 | | |
642 | | - | |
| 626 | + | |
643 | 627 | | |
644 | 628 | | |
645 | 629 | | |
| |||
718 | 702 | | |
719 | 703 | | |
720 | 704 | | |
721 | | - | |
| 705 | + | |
722 | 706 | | |
723 | 707 | | |
724 | 708 | | |
| |||
926 | 910 | | |
927 | 911 | | |
928 | 912 | | |
929 | | - | |
| 913 | + | |
930 | 914 | | |
931 | 915 | | |
932 | 916 | | |
| |||
995 | 979 | | |
996 | 980 | | |
997 | 981 | | |
998 | | - | |
| 982 | + | |
999 | 983 | | |
1000 | 984 | | |
1001 | 985 | | |
| |||
1047 | 1031 | | |
1048 | 1032 | | |
1049 | 1033 | | |
1050 | | - | |
| 1034 | + | |
1051 | 1035 | | |
1052 | 1036 | | |
1053 | 1037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
0 commit comments