INNER CODE UNIT · Python

test_message_junit5_tail_edge_cases

apache/ozone · dev-support/ci/test_junit_summary.py:87

  def test_message_junit5_tail_edge_cases(self):
    fromstring = junit_summary.ET.fromstring
    # short custom messages are meaningful and kept in full
    elem = fromstring('<failure message="wrong count ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;"/>')
    self.assertEqual(junit_summary.clean_message(elem), "wrong count ==> expected: <1> but was: <2>")
    # assertion values containing " ==> " must not corrupt the tail
    long_context = "x" * 400
    elem = fromstring('<failure message="%s ==&gt; expected: &lt;a ==&gt; b&gt; but was: &lt;c&gt;"/>' % long_context)
    self.assertEqual(junit_summary.clean_message(elem), "expected: <a ==> b> but was: <c>")
    # long messages with " ==> " but no assertion framing fall back to head truncation
    elem = fromstring('<failure message="pipeline A ==&gt; B failed %s"/>' % long_context)
    self.assertTrue(junit_summary.clean_message(elem).startswith("pipeline A ==> B failed"))

  def test_module_name_from_path(self):
    # normal surefire layout: module is the dir above target/
    self.assertEqual(junit_summary.module_name("hadoop-hdds/common/target/surefire-reports/TEST-a.xml"), "common")
    # layout after _mvn_unit_report.sh moves a failed test's XML under target/<check>/<module-path>/
    self.assertEqual(junit_summary.module_name("target/unit/hadoop-hdds/common/TEST-a.xml"), "common")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…