Commit 252f688
Fix
Summary:
`test_strict_compile` patched `StrictSourceFileLoader.source_to_code` to return
`None` class-wide, to prove that `a.py` is loaded from the pyc built by
`strict_compile()` rather than recompiled. But `a.py` executes `import
__strict__`, which goes through that same patched loader, so the test only
passes when `__strict__` already has a valid cached pyc.
Under `ctr` the whole module runs in one process and an earlier test warms
`__strict__/__pycache__/__init__.cpython-314.strict.pyc`, so the test passes.
Under `buck test` each test method gets its own process against a cold
link-tree, so it always failed with:
ImportError: Cannot import module __strict__; get_code() returned None
Scope the patch to `a.py` so the modules its body pulls in still compile
normally.
Reviewed By: yoney
Differential Revision: D116071905
fbshipit-source-id: 2e93b833ff3d1e4c1a3a9d8f21884e142f4d3f1ctest_strict_compile depending on a warm __strict__ pyc1 parent 51a4794 commit 252f688
1 file changed
Lines changed: 18 additions & 5 deletions
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
522 | 535 | | |
523 | 536 | | |
524 | 537 | | |
| |||
0 commit comments