From 4d31faf728b9e6b77f231c7193266a5927423425 Mon Sep 17 00:00:00 2001 From: Jitendra Yejare Date: Wed, 3 Jan 2024 17:03:02 +0530 Subject: [PATCH] Markers as test property in reports (#13043) (cherry picked from commit 8d9af7883fa241ac1a7a7083b0b468ca4668c3e3) --- 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