Skip to content

Commit

Permalink
Add marker for case insensitive test collection by component and impo…
Browse files Browse the repository at this point in the history
…rtance (SatelliteQE#15005)

Collect tests with case insensitive component marker
  • Loading branch information
shweta83 authored and jyejare committed Oct 19, 2024
1 parent a4c542f commit 7d3784d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pytest_plugins/metadata_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def pytest_collection_modifyitems(items, config):

# split the option string and handle no option, single option, multiple
# config.getoption(default) doesn't work like you think it does, hence or ''
importance = [i for i in (config.getoption('importance') or '').split(',') if i != '']
component = [c for c in (config.getoption('component') or '').split(',') if c != '']
importance = [i.lower() for i in (config.getoption('importance') or '').split(',') if i != '']
component = [c.lower() for c in (config.getoption('component') or '').split(',') if c != '']
team = [a.lower() for a in (config.getoption('team') or '').split(',') if a != '']
verifies_issues = config.getoption('verifies_issues')
blocked_by = config.getoption('blocked_by')
Expand Down Expand Up @@ -192,10 +192,10 @@ def pytest_collection_modifyitems(items, config):
# only add the mark if it hasn't already been applied at a lower scope
doc_component = component_regex.findall(docstring)
if doc_component and 'component' not in item_mark_names:
item.add_marker(pytest.mark.component(doc_component[0]))
item.add_marker(pytest.mark.component(doc_component[0].lower()))
doc_importance = importance_regex.findall(docstring)
if doc_importance and 'importance' not in item_mark_names:
item.add_marker(pytest.mark.importance(doc_importance[0]))
item.add_marker(pytest.mark.importance(doc_importance[0].lower()))
doc_team = team_regex.findall(docstring)
if doc_team and 'team' not in item_mark_names:
item.add_marker(pytest.mark.team(doc_team[0].lower()))
Expand Down

0 comments on commit 7d3784d

Please sign in to comment.