feat(normalizer): add main() CLI to persons_tree

Wires the two-pass pipeline (parse → deduplicate → index → resolve)
into a runnable CLI with --input, --output, and --dry-run flags.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-25 21:16:21 +02:00
parent 34c40cb0ee
commit e326630318
2 changed files with 121 additions and 0 deletions

View File

@@ -431,3 +431,27 @@ def test_parse_bemerkung_sohn_with_trailing_remark():
assert len(rels) == 2
assert unres == []
assert notes == "nach Mexiko emigriert"
import subprocess
def test_dry_run_exits_zero(tmp_path):
"""dry-run should complete without writing any file and exit 0."""
input_path = Path(__file__).parent.parent.parent.parent / "import" / "Personendatei 2.xlsx"
if not input_path.exists():
import pytest
pytest.skip("source Excel file not present")
result = subprocess.run(
[
sys.executable, str(Path(__file__).parent.parent / "persons_tree.py"),
"--input", str(input_path),
"--output", str(tmp_path / "out.json"),
"--dry-run",
],
capture_output=True, text=True,
)
assert result.returncode == 0, result.stderr
assert not (tmp_path / "out.json").exists()
assert "persons parsed" in result.stdout