Skip to content

Commit

Permalink
fix package-query patterns for options (#13618)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Apr 5, 2023
1 parent 425cbcc commit 20705e7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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

0 comments on commit 20705e7

Please sign in to comment.