Repository navigation
Commit e52b7f8
committed
fix(util): tolerate deleted temporary environment variables
When a `patch_env()` body deletes a variable that was initially absent,
cleanup raises `KeyError` and can mask an exception from the body.
Use `os.environ.pop(name, None)` to restore absence idempotently while
preserving restoration of existing values.
Add 18 regression cases for absent, empty and populated original values,
keep/replace/delete body mutations and normal/exceptional exits.
The focused CLI-backend tests changed from 2 failed and 16 passed to
18 passed. Ruff lint/format and `git diff --check` passed. The full suite
was not run because its required `GixPython` Windows wheel was unavailable.
Agent-Model: unknown1 parent 8e919a4 commit e52b7f8
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments