Repository navigation
Commit cce22ba
Convert remaining rorepo-mutating tests to @with_rw_repo
Two further `TestRepo` tests in `test/test_repo.py` mutate
`self.rorepo` on disk:
- `test_daemon_export` toggles `self.rorepo.daemon_export`, which
creates and removes `.git/git-daemon-export-ok` via `touch` and
`os.unlink`.
- `test_alternates` assigns to `self.rorepo.alternates`, which
writes and removes `<common_dir>/objects/info/alternates` via
`open(..., "wb")` and `os.remove`.
Both bracket their writes with a save-and-restore pattern, so on
the happy path the on-disk state ends up unchanged; on a mid-test
abort the rorepo is left with stray state. Neither test produces
git lock files, which is why an earlier scope based on lock-
leaking tests did not pick them up. The contract violation is the
same in shape (transient mutation of a fixture documented as
read-only and shared across tests), and the same conversion
applies: `@with_rw_repo("HEAD")` confines the writes to a per-test
temp clone destined for cleanup.
Note that `@with_rw_repo` clones with `shared=True`, which sets
the clone's `objects/info/alternates` to point back at the source
repository's `objects/`. In `test_alternates` this means
`cur_alternates` reads back as one entry rather than the empty
list typical on the rorepo. The test's save/empty/set/restore
sequence still exercises the same setter contract; the asserts
verify what the setter wrote at each step.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f64e36a commit cce22ba
1 file changed
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
312 | 314 | | |
313 | | - | |
314 | | - | |
| 315 | + | |
| 316 | + | |
315 | 317 | | |
316 | | - | |
317 | | - | |
318 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| |||
0 commit comments