Implement story 1.2: config read/write/wipe
Add provisioning/config.py with read/write/wipe functions, update conftest.py with autouse CONFIG_PATH patch fixture, write 7 tests covering all acceptance criteria, and extend pyproject.toml per-file-ignores so conftest.py may import from provisioning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1 +1,22 @@
|
||||
# stub
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from planemapper.constants import CONFIG_PATH as _CONFIG_PATH
|
||||
|
||||
# Module-level reference so tests can monkeypatch this name
|
||||
CONFIG_PATH: Path = _CONFIG_PATH
|
||||
|
||||
|
||||
def read() -> dict:
|
||||
with CONFIG_PATH.open() as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def write(data: dict) -> None:
|
||||
CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
with CONFIG_PATH.open("w") as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
|
||||
def wipe() -> None:
|
||||
CONFIG_PATH.unlink(missing_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user