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

test: add tests on handling of duplicate matrix selectors #102

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
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
24 changes: 24 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ def test_generate_matrix():
assert matrix is None


def test_generate_matrix_allows_duplicates_and_chooses_the_final_value():
# duplicate keys
matrix = generate_matrix("thing=abc;other_thing=true;thing=def;thing=ghi")
assert matrix == {"other_thing": ["true"], "thing": ["ghi"]}

# duplicate keys and values
matrix = generate_matrix("thing=abc;thing=abc")
assert matrix == {"thing": ["abc"]}


def test_validate_args():
# Missing output
with pytest.raises(Exception):
Expand Down Expand Up @@ -106,3 +116,17 @@ def test_validate_args():
"my_other_channel",
]
)

# Valid, with duplicates in --matrix
validate_args(
[
"-c",
"dependencies2.yaml",
"--output",
"pyproject",
"--matrix",
"cuda_suffixed=true;arch=x86_64;cuda_suffixed=false",
"--file-key",
"all",
]
)
Loading