diff --git a/conans/client/graph/python_requires.py b/conans/client/graph/python_requires.py index 47ee58d9e0b..814c91e5696 100644 --- a/conans/client/graph/python_requires.py +++ b/conans/client/graph/python_requires.py @@ -101,8 +101,8 @@ def _resolve_ref(self, requirement, graph_lock, remotes, update): "Please use version ranges instead") if graph_lock: graph_lock.resolve_locked_pyrequires(requirement) - else: - self._range_resolver.resolve(requirement, "py_require", remotes, update) + # If the lock hasn't resolved the range, and it hasn't failed (it is partial), resolve it + self._range_resolver.resolve(requirement, "py_require", remotes, update) ref = requirement.ref return ref diff --git a/conans/test/integration/py_requires/python_requires_test.py b/conans/test/integration/py_requires/python_requires_test.py index 55404c3abd3..39cee22c2a9 100644 --- a/conans/test/integration/py_requires/python_requires_test.py +++ b/conans/test/integration/py_requires/python_requires_test.py @@ -1164,3 +1164,20 @@ def test_multi_top_missing_from_remote(): assert "dep/1.0@user/testing: Downloaded recipe revision" in tc.out assert "base/1.1@user/testing: Not found in local cache, looking in remotes..." in tc.out assert "base/1.1@user/testing: Downloaded recipe revision" in tc.out + + +def test_transitive_range_not_found_in_cache(): + """ + https://github.com/conan-io/conan/issues/13761 + """ + c = TestClient() + c.save({"conanfile.py": GenConanfile("pr", "1.0")}) + c.run("create .") + + c.save({"conanfile.py": GenConanfile("dep", "1.0").with_python_requires("pr/[>0]")}) + c.run("create .") + + c.save({"conanfile.py": GenConanfile("pkg", "1.0").with_requires("dep/1.0")}) + c.run("create . ") + c.assert_listed_require({"pr/1.0": "Cache"}, python=True) + assert "pr/[>0]: pr/1.0" in c.out