Skip to content

Commit

Permalink
[6.12.z] Markers as test property in reports (#13043) (#13601)
Browse files Browse the repository at this point in the history
Markers as test property in reports (#13043)
  • Loading branch information
jyejare authored Jan 4, 2024
1 parent f916bc5 commit c8ef54f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pytest_plugins/metadata_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit c8ef54f

Please sign in to comment.