INNER CODE UNIT · Python
module_name
apache/ozone · dev-support/ci/junit_summary.py:55
def module_name(xml_path):
# Works for both layouts: <module>/target/surefire-reports/TEST-*.xml (normal run)
# and target/<check>/<module-path>/TEST-*.xml (failed tests moved by _mvn_unit_report.sh).
parts = os.path.normpath(xml_path).split(os.sep)[:-1]
while parts and parts[-1] in ("surefire-reports", "failsafe-reports", "target"):
parts.pop()
return parts[-1] if parts else "-"
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: