57 lines
2.8 KiB
Python
57 lines
2.8 KiB
Python
import unittest
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[1]
|
||
RULESET_TSL = ROOT / "rulesets" / "tsl" / "index.md"
|
||
README = ROOT / "README.md"
|
||
PLAYBOOK_EXAMPLE = ROOT / "playbook.toml.example"
|
||
SKILLS_DOC = ROOT / "SKILLS.md"
|
||
TEMPLATES_CI_README = ROOT / "templates" / "ci" / "README.md"
|
||
REMOVED_TSL_GUIDE = ROOT / "codex" / "skills" / "tsl-guide"
|
||
|
||
|
||
class TslEntrypointsConsistencyTests(unittest.TestCase):
|
||
def test_ruleset_lists_canonical_tsl_layers(self):
|
||
text = RULESET_TSL.read_text(encoding="utf-8")
|
||
self.assertIn("docs/tsl/index.md", text)
|
||
self.assertIn("docs/tsl/syntax/index.md", text)
|
||
self.assertIn("docs/tsl/finance/index.md", text)
|
||
self.assertIn("docs/tsl/modules/index.md", text)
|
||
self.assertIn("docs/tsl/reference/index.md", text)
|
||
|
||
def test_readme_only_lists_two_official_deployment_routes(self):
|
||
text = README.read_text(encoding="utf-8")
|
||
self.assertIn("方式一:git subtree", text)
|
||
self.assertIn("方式二:外部 clone 后执行部署", text)
|
||
self.assertIn("`project_root`:目标项目根目录", text)
|
||
self.assertIn("`deploy_root`:相对于 `project_root` 的项目内目标目录", text)
|
||
self.assertIn("不是外部 clone 出来的 Playbook 仓库路径", text)
|
||
self.assertIn("外部 clone 场景下必须显式填写 `deploy_root`", text)
|
||
self.assertNotIn("方式二:手动复制快照", text)
|
||
self.assertNotIn("方式三:CLI 裁剪复制", text)
|
||
self.assertNotIn("如果省略 `deploy_root`,默认仍部署到 `docs/standards/playbook`", text)
|
||
|
||
def test_playbook_example_defines_deploy_root_as_target_path(self):
|
||
text = PLAYBOOK_EXAMPLE.read_text(encoding="utf-8")
|
||
self.assertIn('deploy_root = "docs/standards/playbook"', text)
|
||
self.assertIn("相对于 project_root", text)
|
||
self.assertIn("不是外部 clone 的 playbook 路径", text)
|
||
self.assertIn("从外部 clone 执行时必填", text)
|
||
self.assertNotIn("target_dir", text)
|
||
|
||
def test_deployment_docs_do_not_reference_legacy_terms(self):
|
||
self.assertNotIn("vendoring", README.read_text(encoding="utf-8"))
|
||
self.assertNotIn("`.tmp`", README.read_text(encoding="utf-8"))
|
||
self.assertNotIn("vendoring", SKILLS_DOC.read_text(encoding="utf-8"))
|
||
self.assertNotIn("vendoring", TEMPLATES_CI_README.read_text(encoding="utf-8"))
|
||
|
||
def test_repo_no_longer_ships_tsl_guide_skill(self):
|
||
self.assertFalse(REMOVED_TSL_GUIDE.exists())
|
||
self.assertNotIn("tsl-guide", README.read_text(encoding="utf-8"))
|
||
self.assertNotIn("tsl-guide", SKILLS_DOC.read_text(encoding="utf-8"))
|
||
self.assertNotIn("$tsl-guide", RULESET_TSL.read_text(encoding="utf-8"))
|
||
|
||
|
||
if __name__ == "__main__":
|
||
unittest.main()
|