Skip to content

Commit

Permalink
Merge pull request #174 from xcp-ng/assembre-k-options
Browse files Browse the repository at this point in the history
Merge name filters into one
  • Loading branch information
stormi authored Sep 28, 2023
2 parents 125f360 + 97a8f56 commit a402a3c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,24 @@ def build_pytest_cmd(job_data, hosts=None, pytest_args=[]):

job_params = dict(job_data["params"])

# Merge name filter
cli_name_filters = []
try:
while True:
i = pytest_args.index("-k")
value = pytest_args[i + 1]
del pytest_args[i + 1]
del pytest_args[i]
cli_name_filters.append(value)
except ValueError:
pass

joined_cli_filters = ") and (".join(cli_name_filters)
if name_filter and joined_cli_filters:
name_filter = f"({name_filter}) and ({joined_cli_filters})"
elif joined_cli_filters:
name_filter = f"({joined_cli_filters})"

# pytest_args may override job_params
pytest_args_keys = []
for arg in pytest_args:
Expand Down

0 comments on commit a402a3c

Please sign in to comment.