code: def test_build_xml(capsys):
      rows = parse_stdout.parse_rows(stdout.splitlines())
      parse_stdout.build_xml(rows)
      actual = capsys.readouterr().out.strip()
      # Remove timestamp
      actual = re.sub(
          r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}", r"snip", actual
      )
  
      expect = """
  <?xml version="1.0" encoding="utf-8"?>
  <testsuites>
  <testsuite name="distributed" errors="3" failures="3" skipped="2" tests="15" time="0.0" timestamp="snip" hostname="">
  <testcase classname="distributed.tests.test1" name="test_fail" time="0.0"><failure message=""></failure></testcase>
  <testcase classname="distributed.tests.test1" name="test_error_in_setup" time="0.0"><error message="failed on setup"></error></testcase>
  <testcase classname="distributed.tests.test1" name="test_pass_and_then_error_in_teardown" time="0.0"><error message="failed on teardown"></error></testcase>
  <testcase classname="distributed.tests.test1" name="test_fail_and_then_error_in_teardown" time="0.0"><failure message=""></failure></testcase>
  <testcase classname="distributed.tests.test1" name="test_fail_and_then_error_in_teardown" time="0.0"><error message="failed on teardown"></error></testcase>
  <testcase classname="distributed.tests.test1" name="test_skip" time="0.0"><skipped type="pytest.skip" message="skip"></skipped></testcase>
  <testcase classname="distributed.tests.test1" name="test_xfail" time="0.0"><skipped type="pytest.xfail" message="xfail"></skipped></testcase>
  <testcase classname="distributed.tests.test1" name="test_flaky" time="0.0" />
  <testcase classname="distributed.tests.test1" name="test_leaking" time="0.0" />
  <testcase classname="distributed.tests.test1" name="test_pass" time="0.0" />
  <testcase classname="distributed.tests.test1" name="test_params[a a]" time="0.0" />
  <testcase classname="distributed.tests.test1" name="test_escape_chars[&lt;lambda&gt;]" time="0.0" />
  <testcase classname="distributed.tests.test1.MyTest" name="test_unittest" time="0.0" />
  <testcase classname="distributed.tests.test1" name="test_timeout" time="0.0"><failure message="pytest-timeout exceeded"></failure></testcase>
  </testsuite>
  </testsuites>
      """.strip()
  
      assert actual == expect
  
imports: from __future__ import annotations
  import os
  import re
  import sys
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_build_xml(capsys) without return types