Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

refactor(test): 定向调试拆成 run_focus,main 回到复杂度记录之内

longmeidao636cf4ff1357
diff --git a/scripts/test_runner.py b/scripts/test_runner.py
index 09da48cd3..7942ae42f 100644
--- a/scripts/test_runner.py
+++ b/scripts/test_runner.py
@@ -1118,15 +1118,7 @@ def main(argv: list[str] | None = None) -> int:
print("\n".join(("full", "auto", *SCOPES)))
return 0
if args.focus:
- if args.shard_count != 1:
- parser.error("定向调试不能与分片一起使用")
- from . import test_focus
- heavy = any(selector.startswith("frontend/") for selector in args.focus)
- try:
- with machine_guard(args, heavy):
- return test_focus.run(sys.modules[__name__], args)
- except test_evidence.Timeout as error:
- return busy(error)
+ return run_focus(parser, args)
if os.environ.get("PEACH_TEST_FOCUS") or os.environ.get("PEACH_E2E_FILES") or os.environ.get("PEACH_VITEST_FILES"):
parser.error("定向调试环境不能签发正式记录;请清除 PEACH_TEST_FOCUS、PEACH_E2E_FILES 与 PEACH_VITEST_FILES")
requested: tuple[str, ...] = tuple(dict.fromkeys(args.scopes or ("auto",)))
@@ -1164,6 +1156,19 @@ def main(argv: list[str] | None = None) -> int:
return busy(error)
+def run_focus(parser, args) -> int:
+ """定向调试:不签发记录;浏览器与 vitest 文件起浏览器或 node,同样排整机的重负载锁。"""
+ if args.shard_count != 1:
+ parser.error("定向调试不能与分片一起使用")
+ from . import test_focus
+ heavy = any(selector.startswith("frontend/") for selector in args.focus)
+ try:
+ with machine_guard(args, heavy):
+ return test_focus.run(sys.modules[__name__], args)
+ except test_evidence.Timeout as error:
+ return busy(error)
+
+
#: 会起浏览器或整套 vitest 的测试文件。选中它们的运行与全量一样要排整机的重负载锁。
HEAVY_FILES = frozenset({"test_web_e2e", "test_frontend_build"})