Commit b7ba220
test(set-workspace): segment-aware
Two test-hygiene follow-ups from a structured re-review of PR #22; no
production code changes.
1. tests/test_workspace_path_validation.py — test_returns_canonical_path_collapsing_dotdot
The canonical-path assertion was a substring check against `..` on
the raw realpath string. That would spuriously fail if the OS-supplied
tempdir name ever embedded `..` in a folder component — substring
presence is the wrong primitive for the invariant we actually care
about, which is "no `..` *segment* in the canonical path." Switched
to `Path(result).parts`, which handles `\` vs `/` natively and
asserts on path components.
2. tests/test_workspace_path_validation.py — TestSetWorkspaceApi.setUp
The 200-path test mutates the module-global _workspace_path_override
in utils/workspace_path.py via the API, and the tempdir it then
points at is rmtree'd by the existing cleanup. Without an explicit
reset, the global stays pinned at a now-deleted path across tests.
Added addCleanup(set_workspace_path_override, None) so any future
sibling test inspecting the override sees a clean None.
Full suite: 152/152 OK (skipped=2 POSIX-only symlink tests on Windows).
No behaviour change; ReadLints clean.
Co-authored-by: Cursor <cursoragent@cursor.com>.. assert + reset override after API tests1 parent a3b89bf commit b7ba220
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
| |||
0 commit comments