Commit 360f113
committed
fix(tests): capture real __import__ before patching builtins to avoid recursion
fake_import closures that called __import__ directly would resolve to
themselves after patch("builtins.__import__") was applied, causing
RecursionError instead of the expected ImportError path. Capture
builtins.__import__ into _real_import before the patch context so the
fallthrough call uses the original import machinery.
Fixes test_import_error_raises_embeddings_unavailable and the same
pattern in test_debug_log_fires_before_raise_on_import_error.1 parent 41e4bd8 commit 360f113
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
| 360 | + | |
360 | 361 | | |
| 362 | + | |
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | 366 | | |
365 | | - | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
| 392 | + | |
| 393 | + | |
390 | 394 | | |
| 395 | + | |
391 | 396 | | |
392 | 397 | | |
393 | 398 | | |
394 | 399 | | |
395 | | - | |
| 400 | + | |
396 | 401 | | |
397 | 402 | | |
398 | 403 | | |
| |||
0 commit comments