From 7ef255f3e3683ad6f7eafa8034526d33cb41597e Mon Sep 17 00:00:00 2001 From: Jitendra Yejare Date: Thu, 4 Jan 2024 21:58:44 +0530 Subject: [PATCH] Fixing the missing markers as independent properties (#13599) (cherry picked from commit ae99d0d0fe2ceda3d35c6586788e1587ab3c5ff6) --- pytest_plugins/metadata_markers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pytest_plugins/metadata_markers.py b/pytest_plugins/metadata_markers.py index 311628a8962..57b12aa5c1f 100644 --- a/pytest_plugins/metadata_markers.py +++ b/pytest_plugins/metadata_markers.py @@ -119,12 +119,15 @@ def pytest_collection_modifyitems(items, config): markers_prop_data = [] exclude_markers = ['parametrize', 'skipif', 'usefixtures', 'skip_if_not_set'] for marker in item.iter_markers(): - prop = marker.name - if prop in exclude_markers: + proprty = marker.name + if proprty in exclude_markers: continue if marker_val := next(iter(marker.args), None): - prop = '='.join([prop, str(marker_val)]) - markers_prop_data.append(prop) + proprty = '='.join([proprty, str(marker_val)]) + markers_prop_data.append(proprty) + # Adding independent marker as a property + item.user_properties.append((marker.name, marker_val)) + # Adding all markers as a single property item.user_properties.append(("markers", ", ".join(markers_prop_data))) # Version specific user properties