Commit 76e9f84
Review
fix(ex_app): keep
The previous fix piped every progress update through
``asyncio.run_coroutine_threadsafe(nc.set_init_status(...), loop)``. That works at
runtime but breaks ``tests_unit/test_fetch_model_file.py``, which drives
``fetch_models_task`` from a regular sync test with a ``MagicMock`` ``nc``: there is
no event loop and no real coroutine, so the loop-scheduling branch short-circuits
and ``nc.set_init_status`` was never called at all.
Make ``_ProgressReporter.__call__`` invoke ``nc.set_init_status`` unconditionally so
mocks (and any future sync ``NextcloudApp`` shim) observe the call. Inspect the
return value: if it is a coroutine, schedule it on the captured loop and wait
for the result; if there is no loop available, ``coro.close()`` to avoid the
"coroutine never awaited" warning; if it is not a coroutine at all (the mock
case) just drop it.
Also drop the empty ``error`` argument when calling ``set_init_status`` to keep
the call signature identical to the pre-Phase-2 behaviour, so existing tests
that assert ``call(100)`` rather than ``call(100, "")`` keep matching.set_init_status mockable from sync tests1 parent 69823ec commit 76e9f84
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
213 | 222 | | |
| 223 | + | |
214 | 224 | | |
215 | | - | |
| 225 | + | |
216 | 226 | | |
217 | 227 | | |
218 | 228 | | |
| |||
0 commit comments