Commit e509941
committed
fix(cli): type the job reporter as a protocol so the suite type-checks
CI runs mypy over tests as well as src, and these tests were red: the recording
fakes they pass to JobRegistry.start and JobLogTailer are not HandlerCallbacks.
Neither collaborator wants the socket transport -- they want somewhere to send a
result and somewhere to send logs -- so say that: JobReporter is a Protocol with
those two methods, and HandlerCallback satisfies it structurally. The fakes then
type-check as themselves rather than needing a cast at every call site.
Worth noting the protocol immediately found a real gap: test_server_async's
FakeCallback had no post_logs at all, so the tailer's calls into it were only
ever working by accident of it never being exercised there.
The rest is local: cast the _FakeRequest stand-ins to web.Request at the two
handle_start call sites, and narrow web.Response.text (str | None) before
json.loads and `in`.1 parent 01c1fb1 commit e509941
3 files changed
Lines changed: 42 additions & 15 deletions
File tree
- packages/uipath
- src/uipath/_cli
- tests/cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
93 | 105 | | |
94 | 106 | | |
95 | 107 | | |
| |||
200 | 212 | | |
201 | 213 | | |
202 | 214 | | |
203 | | - | |
| 215 | + | |
204 | 216 | | |
205 | 217 | | |
206 | 218 | | |
| |||
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
310 | | - | |
| 322 | + | |
311 | 323 | | |
312 | 324 | | |
313 | 325 | | |
| |||
330 | 342 | | |
331 | 343 | | |
332 | 344 | | |
333 | | - | |
| 345 | + | |
334 | 346 | | |
335 | 347 | | |
336 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
264 | 278 | | |
265 | 279 | | |
266 | 280 | | |
| |||
276 | 290 | | |
277 | 291 | | |
278 | 292 | | |
279 | | - | |
| 293 | + | |
280 | 294 | | |
281 | 295 | | |
282 | 296 | | |
283 | 297 | | |
284 | 298 | | |
285 | 299 | | |
286 | | - | |
| 300 | + | |
287 | 301 | | |
288 | 302 | | |
289 | 303 | | |
| |||
295 | 309 | | |
296 | 310 | | |
297 | 311 | | |
298 | | - | |
| 312 | + | |
299 | 313 | | |
300 | 314 | | |
301 | 315 | | |
302 | 316 | | |
303 | 317 | | |
304 | | - | |
| 318 | + | |
305 | 319 | | |
306 | 320 | | |
307 | 321 | | |
| |||
319 | 333 | | |
320 | 334 | | |
321 | 335 | | |
322 | | - | |
| 336 | + | |
323 | 337 | | |
324 | 338 | | |
325 | 339 | | |
326 | | - | |
| 340 | + | |
327 | 341 | | |
328 | 342 | | |
329 | 343 | | |
| |||
362 | 376 | | |
363 | 377 | | |
364 | 378 | | |
365 | | - | |
| 379 | + | |
366 | 380 | | |
367 | 381 | | |
368 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | | - | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
0 commit comments