sync 09774fb57f858f9c5ec5ed7b376a0ecf6a56f41b..fbf7d572b3bcc78fe9c54f3313e48a4786d6b6e3
Browse files
tests/test_v78_ci_preflight.py
CHANGED
|
@@ -44,9 +44,9 @@ class TestStructure(unittest.TestCase):
|
|
| 44 |
cls.m = load_preflight()
|
| 45 |
|
| 46 |
def test_01_ten_steps(self):
|
| 47 |
-
"""T01:步骤表恰好
|
| 48 |
-
self.assertEqual(len(self.m.STEPS),
|
| 49 |
-
self.assertEqual(len(self.m.declared_ci_names()),
|
| 50 |
|
| 51 |
def test_02_unique_ids_and_kinds(self):
|
| 52 |
"""T02:id 唯一,kind 只能是 info / run / multi。"""
|
|
@@ -84,11 +84,11 @@ class TestContract(unittest.TestCase):
|
|
| 84 |
self.assertEqual(rep["missing"], [], "无人认领的 ci 步骤:%r" % (rep["missing"],))
|
| 85 |
|
| 86 |
def test_06_contract_aligned(self):
|
| 87 |
-
"""T06:双向对齐结论为 True,且两边计数都是
|
| 88 |
rep = self.m.contract_report(WORKFLOW)
|
| 89 |
self.assertTrue(rep["aligned"])
|
| 90 |
-
self.assertEqual(rep["ci_steps"],
|
| 91 |
-
self.assertEqual(rep["claimed_steps"],
|
| 92 |
self.assertEqual(rep["unused"], [])
|
| 93 |
|
| 94 |
def test_07_tampered_workflow_goes_red(self):
|
|
@@ -138,13 +138,13 @@ class TestBehaviour(unittest.TestCase):
|
|
| 138 |
self.assertNotEqual(r["rc"], 0)
|
| 139 |
|
| 140 |
def test_11_list_does_not_execute(self):
|
| 141 |
-
"""T11:--list 只打印步骤表,不执行任何门禁(rc=0 且列出
|
| 142 |
proc = subprocess.run([sys.executable, SCRIPT, "--list"], cwd=ROOT,
|
| 143 |
capture_output=True, text=True, encoding="utf-8",
|
| 144 |
errors="replace", timeout=120)
|
| 145 |
self.assertEqual(proc.returncode, 0, proc.stderr[-300:])
|
| 146 |
lines = [ln for ln in (proc.stdout or "").splitlines() if ln.strip()]
|
| 147 |
-
self.assertEqual(len(lines),
|
| 148 |
|
| 149 |
def test_12_report_fields_and_zero_dependency(self):
|
| 150 |
"""T12:报告字段齐(含契约段),且源码不引第三方库。"""
|
|
|
|
| 44 |
cls.m = load_preflight()
|
| 45 |
|
| 46 |
def test_01_ten_steps(self):
|
| 47 |
+
"""T01:步骤表恰好 16 面(V88:+Tautology / GenomeDNA / Credential / AssetCensus),与 ci.yml 对齐。"""
|
| 48 |
+
self.assertEqual(len(self.m.STEPS), 16)
|
| 49 |
+
self.assertEqual(len(self.m.declared_ci_names()), 16)
|
| 50 |
|
| 51 |
def test_02_unique_ids_and_kinds(self):
|
| 52 |
"""T02:id 唯一,kind 只能是 info / run / multi。"""
|
|
|
|
| 84 |
self.assertEqual(rep["missing"], [], "无人认领的 ci 步骤:%r" % (rep["missing"],))
|
| 85 |
|
| 86 |
def test_06_contract_aligned(self):
|
| 87 |
+
"""T06:双向对齐结论为 True,且两边计数都是 16(V88)。"""
|
| 88 |
rep = self.m.contract_report(WORKFLOW)
|
| 89 |
self.assertTrue(rep["aligned"])
|
| 90 |
+
self.assertEqual(rep["ci_steps"], 16)
|
| 91 |
+
self.assertEqual(rep["claimed_steps"], 16)
|
| 92 |
self.assertEqual(rep["unused"], [])
|
| 93 |
|
| 94 |
def test_07_tampered_workflow_goes_red(self):
|
|
|
|
| 138 |
self.assertNotEqual(r["rc"], 0)
|
| 139 |
|
| 140 |
def test_11_list_does_not_execute(self):
|
| 141 |
+
"""T11:--list 只打印步骤表,不执行任何门禁(rc=0 且列出 16 行,V88)。"""
|
| 142 |
proc = subprocess.run([sys.executable, SCRIPT, "--list"], cwd=ROOT,
|
| 143 |
capture_output=True, text=True, encoding="utf-8",
|
| 144 |
errors="replace", timeout=120)
|
| 145 |
self.assertEqual(proc.returncode, 0, proc.stderr[-300:])
|
| 146 |
lines = [ln for ln in (proc.stdout or "").splitlines() if ln.strip()]
|
| 147 |
+
self.assertEqual(len(lines), 16)
|
| 148 |
|
| 149 |
def test_12_report_fields_and_zero_dependency(self):
|
| 150 |
"""T12:报告字段齐(含契约段),且源码不引第三方库。"""
|