INNER CODE UNIT · Python

clean_message

apache/ozone · dev-support/ci/junit_summary.py:64

def clean_message(elem):
  message = " ".join((elem.get("message") or (elem.text or "")).split())
  if len(message) > MESSAGE_LIMIT:
    # JUnit 5 appends "==> expected: ... but was: ..." after the custom message; when a test embeds
    # a whole log as the custom message, drop it and keep the tail with the actual failure
    idx = message.find(" ==> expected:")
    if idx != -1:
      message = message[idx + len(" ==> "):]
  if len(message) > MESSAGE_LIMIT:
    message = message[:MESSAGE_LIMIT] + "..."
  return message


def parse_report(xml_path):
  module = module_name(xml_path)
  cases = []
  for testcase in ET.parse(xml_path).getroot().iter("testcase"):
    failure = next((c for c in testcase if c.tag in FAIL_TAGS), None)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…