-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix list of overlapping versions (#17121)
* Failing test * wip * Cleanup * Discard changes to test/integration/command/export/test_export.py * Cleanup * Docs * Sort by name/version always * Optimize uniqueness by delegating to a simpler sql query * Update tests, currently it fails for the Conan server case * Conan server now does not return duplicated references for each revision * Cleanup
- Loading branch information
Showing
8 changed files
with
56 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
import pytest | ||
|
||
from conan.api.conan_api import ConanAPI | ||
from conan.api.model import Remote | ||
from conans.model.recipe_ref import RecipeReference | ||
from conan.test.assets.genconanfile import GenConanfile | ||
from conan.test.utils.tools import TurboTestClient | ||
from conan.test.utils.tools import TestClient | ||
|
||
|
||
def test_search_recipes(): | ||
@pytest.mark.parametrize("remote_name", [None, "default"]) | ||
def test_search_recipes(remote_name): | ||
""" | ||
Test the "api.search.recipes" | ||
""" | ||
client = TurboTestClient(default_server_user=True) | ||
ref = RecipeReference.loads("foo/1.0") | ||
pref1 = client.create(ref, GenConanfile()) | ||
conanfile_2 = GenConanfile().with_build_msg("change2") | ||
pref2 = client.create(ref, conanfile_2) | ||
pref3 = client.create(RecipeReference.loads("felipe/1.0"), conanfile_2) | ||
client = TestClient(default_server_user=True) | ||
client.save({"conanfile.py": GenConanfile()}) | ||
client.run("create . --name=foo --version=1.0") | ||
client.run("create . --name=felipe --version=2.0") | ||
client.save({"conanfile.py": GenConanfile().with_build_msg("change")}) | ||
# Different version&revision, but 1.0 < 2.0, which has an earlier timestamp | ||
client.run("create . --name=felipe --version=1.0") | ||
# Different revision, newer timestamp | ||
client.run("create . --name=foo --version=1.0") | ||
|
||
client.upload_all(pref1.ref, "default") | ||
client.upload_all(pref2.ref, "default") | ||
client.upload_all(pref3.ref, "default") | ||
client.run("upload * -r=default -c") | ||
|
||
# Search all the recipes locally and in the remote | ||
api = ConanAPI(client.cache_folder) | ||
for remote in [None, api.remotes.get("default")]: | ||
with client.mocked_servers(): | ||
sot = api.search.recipes(query="f*", remote=remote) | ||
assert set(sot) == {RecipeReference.loads("foo/1.0"), | ||
RecipeReference.loads("felipe/1.0")} | ||
remote = api.remotes.get(remote_name) if remote_name else None | ||
|
||
with client.mocked_servers(): | ||
sot = api.search.recipes(query="f*", remote=remote) | ||
assert sot == [RecipeReference.loads("felipe/1.0"), | ||
RecipeReference.loads("felipe/2.0"), | ||
RecipeReference.loads("foo/1.0")] | ||
|
||
sot = api.search.recipes(query="fo*", remote=remote) | ||
assert set(sot) == {RecipeReference.loads("foo/1.0")} | ||
sot = api.search.recipes(query="fo*", remote=remote) | ||
assert sot == [RecipeReference.loads("foo/1.0")] | ||
|
||
sot = api.search.recipes(query=None, remote=remote) | ||
assert set(sot) == {RecipeReference.loads("foo/1.0"), | ||
RecipeReference.loads("felipe/1.0")} | ||
sot = api.search.recipes(query=None, remote=remote) | ||
assert sot == [RecipeReference.loads("felipe/1.0"), | ||
RecipeReference.loads("felipe/2.0"), | ||
RecipeReference.loads("foo/1.0")] | ||
|
||
sot = api.search.recipes(query="*i*", remote=remote) | ||
assert set(sot) == {RecipeReference.loads("felipe/1.0")} | ||
sot = api.search.recipes(query="*i*", remote=remote) | ||
assert sot == [RecipeReference.loads("felipe/1.0"), | ||
RecipeReference.loads("felipe/2.0")] |