Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge name filters into one #174

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading