Files
Neo-ZQYY/scripts/ops/_run_checkpoint6_tests.py

57 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""检查点 6分批运行已完成的属性测试P1, P2, P4, P5, P6, P7, P8, P9, P14, P15"""
import subprocess
import sys
import time
CLASSES = [
"TestProperty1MigrationIdempotency",
"TestProperty14JwtPayloadStructure",
"TestProperty15JwtExpiredInvalidRejection",
"TestProperty2LoginCreateFindUser",
"TestProperty4ApplicationCreation",
"TestProperty5PhoneFormatValidation",
"TestProperty6DuplicateApplicationRejection",
"TestProperty7MatchingMerge",
"TestProperty8ReviewOperations",
"TestProperty9NonPendingReviewRejection",
]
results = {}
for cls in CLASSES:
t0 = time.time()
r = subprocess.run(
[
sys.executable, "-m", "pytest",
f"tests/test_auth_system_properties.py::{cls}",
"-v", "--tb=short", "-x",
],
capture_output=True,
text=True,
timeout=600,
)
elapsed = time.time() - t0
passed = r.returncode == 0
results[cls] = {"passed": passed, "time": f"{elapsed:.1f}s", "rc": r.returncode}
status = "PASS" if passed else "FAIL"
print(f"{status} {cls} ({elapsed:.1f}s)", flush=True)
if not passed:
lines = (r.stdout + r.stderr).strip().split("\n")
for line in lines[-30:]:
print(f" | {line}")
print()
print("=== 汇总 ===")
all_pass = True
for cls, info in results.items():
s = "PASS" if info["passed"] else "FAIL"
if not info["passed"]:
all_pass = False
print(f" {s} {cls} ({info['time']})")
print()
if all_pass:
print("全部通过!")
else:
print("存在失败的测试,请检查上方输出。")