Skip to content

Commit fa4e2ff

Browse files
authored
support for searching test by ID (via #571)
1 parent fcc6bcd commit fa4e2ff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

allure-pytest/src/plugin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ def a_label_type(string):
8383
help="""Comma-separated list of story names.
8484
Run tests that have at least one of the specified story labels.""")
8585

86+
parser.getgroup("general").addoption('--allure-ids',
87+
action="store",
88+
dest="allure_ids",
89+
metavar="IDS_SET",
90+
default={},
91+
type=label_type(LabelType.ID),
92+
help="""Comma-separated list of IDs.
93+
Run tests that have at least one of the specified id labels.""")
94+
8695
def link_pattern(string):
8796
pattern = string.split(':', 1)
8897
if not pattern[0]:
@@ -145,6 +154,7 @@ def select_by_labels(items, config):
145154
arg_labels = set().union(config.option.allure_epics,
146155
config.option.allure_features,
147156
config.option.allure_stories,
157+
config.option.allure_ids,
148158
config.option.allure_severities)
149159
return filter(lambda item: arg_labels & set(allure_labels(item)) if arg_labels else True, items)
150160

0 commit comments

Comments
 (0)