41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Regression tests for the consolidated design-document validator."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
import tempfile
|
|
import unittest
|
|
|
|
import validate_predevelopment_design as validator
|
|
|
|
|
|
class PredevelopmentDesignValidatorTest(unittest.TestCase):
|
|
def test_page_review_markdown_does_not_expand_owner_document_set(self) -> None:
|
|
issues, counts = validator.audit(validator.REPOSITORY_ROOT)
|
|
|
|
extra_documents = [issue for issue in issues if issue.code == "EXTRA_DOCUMENT"]
|
|
self.assertEqual([], extra_documents)
|
|
self.assertEqual(6, counts["documents"])
|
|
self.assertGreaterEqual(counts["supporting_documents"], 2)
|
|
|
|
def test_extra_root_markdown_is_still_rejected(self) -> None:
|
|
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
root = Path(temporary_directory)
|
|
docs = root / "docs"
|
|
docs.mkdir()
|
|
(docs / "README.md").write_text("# Extra\n", encoding="utf-8")
|
|
|
|
issues, _counts = validator.audit(root)
|
|
|
|
self.assertTrue(
|
|
any(
|
|
issue.code == "EXTRA_DOCUMENT" and issue.path == "docs/README.md"
|
|
for issue in issues
|
|
)
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|