[9.18] Fix pytest junitxml output processing for make check

Backport of MR !8443 (merged)

Closes #4401 (closed)

Merge request reports