Repository navigation
Commit 140ebc7
fix: keep generated FastAPI service tests from hanging on codefly.init (#7)
The generated service's pytest hung indefinitely under the Python runtime's
Test step. codefly-sdk's init() walks parent directories for
service.codefly.yaml without stopping at the filesystem root, so it spins
forever when the manifest isn't found — which is exactly the case core's test
runner creates by executing pytest against an isolated source snapshot (the
snapshot holds code/, not the service-root manifest). Importing src.main ran
init() at module load and wedged collection.
- Guard the manifest lookup in main.py with a bounded search; init() only runs
when service.codefly.yaml is actually reachable, and runtime config
otherwise flows through CODEFLY__* env vars.
- Make the admin test hermetic: seed the CODEFLY__* values it needs (setdefault
preserves real runtime values) and drop the codefly.init("..") walk that
would spin in the snapshot.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 206f397 commit 140ebc7
2 files changed
Lines changed: 33 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
6 | 26 | | |
7 | 27 | | |
8 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
1 | 12 | | |
2 | 13 | | |
3 | 14 | | |
4 | 15 | | |
5 | 16 | | |
6 | | - | |
7 | | - | |
8 | 17 | | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
12 | | - | |
13 | 21 | | |
14 | 22 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
0 commit comments