Commit a887885
committed
fix(test): mock create_pr at save_loading import, not github_client internals
The e2e test was patching edit_python_pe.github_client._commit_and_push
which is a private function deep inside create_pr. Python's patch() replaces
names in the module where they are looked up, so patching the original
definition site has no effect when the caller (save_loading.py) has already
imported create_pr as a bound reference.
The correct target is edit_python_pe.screens.save_loading.create_pr, which
is the name actually resolved at call time. With the wrong patch target,
create_pr executed against the real filesystem, raised an exception inside
the perform_save() thread, and the screen never transitioned to
SaveLoadingScreen.
Also:
- Add await pilot.pause() before clicking Save to allow reactive value
assignments to propagate through the Textual event loop first
- Simplify mock setup: one mock_create_pr replaces four separate mocks1 parent 02a8073 commit a887885
1 file changed
Lines changed: 6 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 38 | | |
47 | 39 | | |
48 | 40 | | |
| |||
108 | 100 | | |
109 | 101 | | |
110 | 102 | | |
| 103 | + | |
111 | 104 | | |
112 | 105 | | |
113 | 106 | | |
| |||
0 commit comments