diff --git a/ros_buildfarm/ci_job.py b/ros_buildfarm/ci_job.py index ecd94c6b8..21868f0b1 100644 --- a/ros_buildfarm/ci_job.py +++ b/ros_buildfarm/ci_job.py @@ -295,8 +295,10 @@ def _get_ci_job_config( 'show_images': build_file.show_images, 'show_plots': build_file.show_plots, + # only Ubuntu Focal has a new enough pytest version which generates + # JUnit compliant result files 'xunit_publisher_types': get_xunit_publisher_types_and_patterns( - ros_version), + ros_version, os_name == 'ubuntu' and os_code_name != 'bionic'), } job_config = expand_template(template_name, job_data) return job_config diff --git a/ros_buildfarm/common.py b/ros_buildfarm/common.py index efbb41cdd..ca7e3855c 100644 --- a/ros_buildfarm/common.py +++ b/ros_buildfarm/common.py @@ -591,13 +591,17 @@ def get_package_repo_data(repository_baseurl, targets, cache_dir): return data -def get_xunit_publisher_types_and_patterns(ros_version): +def get_xunit_publisher_types_and_patterns( + ros_version, pytest_junit_compliant, +): types = [] if ros_version == 1: types.append(('GoogleTestType', 'ws/test_results/**/*.xml')) elif ros_version == 2: types.append(('GoogleTestType', 'ws/test_results/**/*.gtest.xml')) - types.append(('JUnitType', 'ws/test_results/**/pytest.xml')) + types.append(( + 'JUnitType' if pytest_junit_compliant else 'GoogleTestType', + 'ws/test_results/**/pytest.xml')) types.append(('JUnitType', 'ws/test_results/**/*.xunit.xml')) else: assert False, 'Unsupported ROS version: ' + str(ros_version) diff --git a/ros_buildfarm/devel_job.py b/ros_buildfarm/devel_job.py index 1618aaae1..f6f5ab41e 100644 --- a/ros_buildfarm/devel_job.py +++ b/ros_buildfarm/devel_job.py @@ -435,8 +435,10 @@ def _get_devel_job_config( 'timeout_minutes': build_file.jenkins_job_timeout, + # only Ubuntu Focal has a new enough pytest version which generates + # JUnit compliant result files 'xunit_publisher_types': get_xunit_publisher_types_and_patterns( - ros_version), + ros_version, os_name == 'ubuntu' and os_code_name != 'bionic'), 'git_ssh_credential_id': config.git_ssh_credential_id,