Commit 58c9e47
authored
fix: ensure tests never access ~/.km directory (#1104)
## Summary
- Tests now create isolated temporary directories instead of using
`~/.km`
- Enforces proper test isolation as required by `docs/AGENTS.md`
- Prevents tests from touching user data
## Changes
- **`tests/Main.Tests/Unit/CLI/CliApplicationBuilderTests.cs`**:
- Implemented `IDisposable` for proper cleanup
- Uses temp directory with unique GUID for each test
- Passes `--config <temp_path>` to avoid `~/.km` access
- **`tests/Main.Tests/Integration/ExamplesCommandOutputTest.cs`**:
- Creates isolated temp directory for config file
- Cleans up temp directory in finally block
## Test plan
- [x] All 520 tests pass (306 Core + 214 Main)
- [x] Zero skipped tests
- [x] Code coverage at 83.82% (above 80% threshold)
- [x] `build.sh` passes with 0 warnings
- [x] `format.sh` passes
- [x] `coverage.sh` passes
- [x] Tests no longer access `~/.km` directory
## Compliance
Per `docs/AGENTS.md`:
> "Tests must never read or write files at `~/.km/` - Tests must use
temp dirs"1 parent 962369d commit 58c9e47
File tree
2 files changed
+56
-6
lines changed- tests/Main.Tests
- Integration
- Unit/CLI
2 files changed
+56
-6
lines changedLines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
29 | | - | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
| 89 | + | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
86 | 100 | | |
87 | 101 | | |
88 | 102 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
9 | 34 | | |
10 | 35 | | |
11 | 36 | | |
| 37 | + | |
12 | 38 | | |
13 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
14 | 45 | | |
15 | 46 | | |
16 | 47 | | |
17 | 48 | | |
18 | 49 | | |
19 | 50 | | |
| 51 | + | |
20 | 52 | | |
21 | | - | |
22 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
23 | 59 | | |
24 | 60 | | |
25 | 61 | | |
0 commit comments