Artifex/tests/test_v2_self_bootstrap_status.py

74 lines
2.6 KiB
Python
Raw Normal View History

from __future__ import annotations
import os
from pathlib import Path
import pytest
def test_v2_self_bootstrap_status_document_exists():
"""Test that the V2 self-bootstrap status document exists."""
docs_dir = Path(__file__).parent.parent / "docs"
status_file = docs_dir / "v2_self_bootstrap_status.md"
assert status_file.exists(), "V2 self-bootstrap status document does not exist"
assert status_file.is_file(), "V2 self-bootstrap status document is not a file"
def test_v2_self_bootstrap_status_required_sections():
"""Test that the V2 self-bootstrap status document contains all required sections."""
docs_dir = Path(__file__).parent.parent / "docs"
status_file = docs_dir / "v2_self_bootstrap_status.md"
assert status_file.exists(), "V2 self-bootstrap status document does not exist"
content = status_file.read_text(encoding="utf-8")
required_sections = [
"Candidate V2 Branch Summary",
"Commits",
"Tests",
"Verification Results",
"Known Issues",
"Unfinished Tasks",
"Lineage Fields"
]
for section in required_sections:
assert section in content, f"Required section '{section}' not found in document"
def test_v2_self_bootstrap_status_lineage_fields():
"""Test that the lineage fields section contains required fields."""
docs_dir = Path(__file__).parent.parent / "docs"
status_file = docs_dir / "v2_self_bootstrap_status.md"
assert status_file.exists(), "V2 self-bootstrap status document does not exist"
content = status_file.read_text(encoding="utf-8")
# Check that lineage fields section exists and contains required fields
assert "Lineage Fields" in content, "Lineage Fields section not found"
# Extract the lineage fields section
lineage_section_start = content.find("## Lineage Fields")
assert lineage_section_start != -1, "Lineage Fields section header not found"
# Find the end of the section (next ## or end of file)
next_section_start = content.find("## ", lineage_section_start + 1)
if next_section_start == -1:
lineage_section = content[lineage_section_start:]
else:
lineage_section = content[lineage_section_start:next_section_start]
required_lineage_fields = [
"Parent Branch",
"Base Commit",
"Candidate Version",
"Created By",
"Status"
]
for field in required_lineage_fields:
assert field in lineage_section, f"Required lineage field '{field}' not found in Lineage Fields section"