From c8ef54f81c7d2289758a05284265ca15bdf3d0dd Mon Sep 17 00:00:00 2001 From: Jitendra Yejare Date: Thu, 4 Jan 2024 20:42:11 +0530 Subject: [PATCH] [6.12.z] Markers as test property in reports (#13043) (#13601) Markers as test property in reports (#13043) --- pytest_plugins/metadata_markers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pytest_plugins/metadata_markers.py b/pytest_plugins/metadata_markers.py index 70aee47c6c7..311628a8962 100644 --- a/pytest_plugins/metadata_markers.py +++ b/pytest_plugins/metadata_markers.py @@ -116,8 +116,18 @@ def pytest_collection_modifyitems(items, config): # add markers as user_properties so they are recorded in XML properties of the report # pytest-ibutsu will include user_properties dict in testresult metadata + markers_prop_data = [] + exclude_markers = ['parametrize', 'skipif', 'usefixtures', 'skip_if_not_set'] for marker in item.iter_markers(): - item.user_properties.append((marker.name, next(iter(marker.args), None))) + prop = marker.name + if prop in exclude_markers: + continue + if marker_val := next(iter(marker.args), None): + prop = '='.join([prop, str(marker_val)]) + markers_prop_data.append(prop) + item.user_properties.append(("markers", ", ".join(markers_prop_data))) + + # Version specific user properties item.user_properties.append(("BaseOS", rhel_version)) item.user_properties.append(("SatelliteVersion", sat_version)) item.user_properties.append(("SnapVersion", snap_version))