From 05d8ab9a9097421ae3eb2e82e1954c2ef7d59a67 Mon Sep 17 00:00:00 2001 From: jyejare Date: Fri, 3 Nov 2023 13:46:33 +0530 Subject: [PATCH] Markers as test property in reports --- pytest_plugins/metadata_markers.py | 12 +++++++++++- tests/foreman/virtwho/ui/test_nutanix_sca.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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)) diff --git a/tests/foreman/virtwho/ui/test_nutanix_sca.py b/tests/foreman/virtwho/ui/test_nutanix_sca.py index eb2d7d889ad..89bae08771d 100644 --- a/tests/foreman/virtwho/ui/test_nutanix_sca.py +++ b/tests/foreman/virtwho/ui/test_nutanix_sca.py @@ -8,7 +8,7 @@ :CaseComponent: Virt-whoConfigurePlugin -:Team: Phoenix +:Team: Phoenix-subscriptions :TestType: Functional