Skip to content

Commit

Permalink
Merge name filters into one
Browse files Browse the repository at this point in the history
`-k` option can't given more than once to pytest
merge the filters from cli and job definition into
one

Signed-off-by: BenjiReis <[email protected]>
  • Loading branch information
benjamreis committed Sep 28, 2023
1 parent 0d076de commit fa36a9d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,19 @@ def build_pytest_cmd(job_data, hosts=None, pytest_args=[]):

job_params = dict(job_data["params"])

# Merge name filter
try:
i = pytest_args.index("-k")
cli_name_filter = pytest_args[i + 1]
del pytest_args[i + 1]
del pytest_args[i]
if name_filter:
name_filter = f"({name_filter}) and ({cli_name_filter})"
else:
name_filter = cli_name_filter
except ValueError:
pass

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

0 comments on commit fa36a9d

Please sign in to comment.