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

fix package-query patterns for options #13618

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions conans/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def compatible_prop(setting_value, _prop_value):
if not prop_name.startswith("options."):
return compatible_prop(info_settings.get(prop_name, None), prop_value)
else:
prop_name = prop_name[len("options."):]
return compatible_prop(info_options.get(prop_name, None), prop_value)


Expand Down
31 changes: 31 additions & 0 deletions conans/test/integration/command_v2/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,37 @@ def test_list_prefs_query_custom_settings():
assert "newsetting.subsetting: 2" not in c.out


def test_list_query_options():
"""
Make sure query works for custom settings
https://github.com/conan-io/conan/issues/13617
"""
c = TestClient(default_server_user=True)
c.save({"conanfile.py": GenConanfile("pkg", "1.0").with_option("myoption", [1, 2, 3])})
c.run("create . -o myoption=1")
c.run("create . -o myoption=2")
c.run("create . -o myoption=3")

c.run("list pkg/1.0:* -p options.myoption=1")
assert "myoption: 1" in c.out
assert "myoption: 2" not in c.out
assert "myoption: 3" not in c.out
c.run("list pkg/1.0:* -p options.myoption=2")
assert "myoption: 1" not in c.out
assert "myoption: 2" in c.out
assert "myoption: 3" not in c.out

c.run("upload * -r=default -c")
c.run("list pkg/1.0:* -p options.myoption=1 -r=default")
assert "myoption: 1" in c.out
assert "myoption: 2" not in c.out
assert "myoption: 3" not in c.out
c.run("list pkg/1.0:* -p options.myoption=2 -r=default")
assert "myoption: 1" not in c.out
assert "myoption: 2" in c.out
assert "myoption: 3" not in c.out


class TestListNoUserChannel:
def test_no_user_channel(self):
c = TestClient(default_server_user=True)
Expand Down