test_atomic_writes.py python
24 lines 734 B
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
1 """Data-integrity tests for atomic per-file writes."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from tests.support import run_cli
8
9
10 def test_no_half_written_file_on_failure(tmp_path: Path) -> None:
11 run_cli(["init", "--regime", "git-only", "--non-interactive"], cwd=tmp_path)
12 target = tmp_path / "docs" / "OVERSEER-HANDOVER.md"
13 original = target.read_bytes()
14
15 from unittest.mock import patch
16
17 with patch("cli.atomic.os.replace", side_effect=OSError("boom")):
18 run_cli(
19 ["init", "--regime", "git-only", "--non-interactive", "--force"],
20 cwd=tmp_path,
21 )
22
23 assert not list(target.parent.glob(".*.overseer.tmp"))
24 assert target.read_bytes() == original
File History 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 52 days ago