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

resolve version ranges for editables too #14510

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions conans/client/graph/range_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _resolve_local(self, search_ref, version_range):
# TODO: This is still necessary to filter user/channel, until search_recipes is fixed
local_found = [ref for ref in local_found if ref.user == search_ref.user
and ref.channel == search_ref.channel]
local_found.extend(self._cache.editable_packages.edited_refs)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
self._cached_cache[pattern] = local_found
if local_found:
return self._resolve_version(version_range, local_found, self._resolve_prereleases)
Expand Down
27 changes: 27 additions & 0 deletions conans/test/integration/editable/test_editable_ranges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.tools import TestClient


def test_editable_ranges():
c = TestClient()
c.save({"dep/conanfile.py": GenConanfile("dep"),
"dep2/conanfile.py": GenConanfile("dep", "0.2"),
"app/conanfile.py": GenConanfile("app", "0.1").with_requires("dep/[>=0.1]")})
c.run("editable add dep --version=0.1")
c.run("install app")
c.assert_listed_require({"dep/0.1": "Editable"})
assert "dep/[>=0.1]: dep/0.1" in c.out

# new version, uses new one
c.run("editable add dep2")
c.run("install app")
c.assert_listed_require({"dep/0.2": "Editable"})
assert "dep/[>=0.1]: dep/0.2" in c.out
assert "dep/0.1" not in c.out

# If a newer one is in cache, it resolves to cache
c.run("create dep --version=0.3")
c.run("install app")
c.assert_listed_require({"dep/0.3": "Cache"})
assert "dep/[>=0.1]: dep/0.3" in c.out
assert "dep/0.1" not in c.out