mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-23 22:27:59 +08:00
* ci: streamline pull request checks and run the full matrix daily Refs #3055 * ci: run runtime contracts only on affected Core checks * test(ci): distinguish SDK checks from SDK publication * fix(ci): retain legacy regressions and scope production image builds * docs(ci): clarify focused regressions and production image selection
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Reject missing evidence, zero cases, skips, xfails and failures in a mandatory suite."""
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
from xml.etree import ElementTree
|
|
|
|
|
|
def verify_report(path: Path) -> int:
|
|
root = ElementTree.parse(path).getroot()
|
|
cases = list(root.iter('testcase'))
|
|
if not cases:
|
|
raise ValueError(f'{path}: no executed cases')
|
|
nonpassing = [
|
|
node.attrib['name']
|
|
for node in cases
|
|
if any(node.find(outcome) is not None for outcome in ('error', 'failure', 'skipped'))
|
|
]
|
|
if nonpassing:
|
|
raise ValueError(f'{path}: mandatory cases did not pass: {", ".join(nonpassing)}')
|
|
return len(cases)
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('reports', type=Path, nargs='+')
|
|
for path in parser.parse_args().reports:
|
|
try:
|
|
print(f'{path}: {verify_report(path)} mandatory cases passed.')
|
|
except (OSError, ValueError, ElementTree.ParseError) as exc:
|
|
parser.exit(1, f'{exc}\n')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|