Files
knowledge-governance/scripts/test_test_changed.py
T
姚章浩 5d00715c3a
build / build (push) Failing after 7m7s
test(qa): 加入目录规则浏览器回归和暂存门禁
在 QA 虚拟机通过 Chromium 复跑和本地提交检查,并验证必填校验失效会触发失败。Gitea 将浏览器回归纳入必需检查。
2026-11-22 19:57:24 +08:00

32 lines
1.5 KiB
Python

import unittest
from test_changed import select_commands
class SelectionTests(unittest.TestCase):
def test_documentation_only(self):
self.assertEqual(select_commands(['docs/DEVELOPMENT_AND_TESTING.md']), [])
def test_go_test_only_selects_its_package(self):
self.assertEqual(select_commands(['internal/governance/a_test.go']),
[['go', 'test', '-count=1', './internal/governance']])
def test_go_source_and_migration_fall_back_to_suite(self):
for name in ('internal/governance/model.go', 'internal/platform/postgres/migrations/0099_qa.up.sql'):
self.assertEqual(select_commands([name]), [['make', 'tests-go']])
def test_frontend_test_only_selects_its_file(self):
self.assertEqual(select_commands(['web/src/scopeRules.test.ts']),
[['npm', '--prefix', 'web', 'test', '--', 'src/scopeRules.test.ts']])
def test_shared_frontend_code_covers_browser_suite(self):
self.assertEqual(select_commands(['web/src/scopeRules.ts']),
[['make', 'tests-web'], ['make', 'tests-e2e']])
def test_e2e_only_runs_browser_suite(self):
self.assertEqual(select_commands(['web/e2e/scope-rules.spec.ts']), [['make', 'tests-e2e']])
def test_unsafe_unknown_paths_fall_back_to_all_relevant_suites(self):
self.assertEqual(select_commands(['new-runtime.conf']),
[['make', 'tests-go'], ['make', 'tests-web'], ['make', 'tests-e2e']])