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 provides conflict error message not showing conflicting provides when a named reference matches a provider #16562

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
2 changes: 1 addition & 1 deletion conans/client/graph/graph_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, node, conflicting_node):

def __str__(self):
return f"Provide Conflict: Both '{self.node.ref}' and '{self.conflicting_node.ref}' " \
f"provide '{self.node.conanfile.provides}'."
f"provide '{self.node.conanfile.provides or self.conflicting_node.conanfile.provides}'."


class GraphRuntimeError(GraphError):
Expand Down
12 changes: 12 additions & 0 deletions test/integration/graph/core/test_provides.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,15 @@ def build_requirements(self):
c.assert_listed_binary({"grpc/0.1": ("9a4eb3c8701508aa9458b1a73d0633783ecc2270", "Build")})
c.assert_listed_binary({"grpc/0.1": ("ebec3dc6d7f6b907b3ada0c3d3cdc83613a2b715", "Cache")},
build=True)


def test_name_provide_error_message():
tc = TestClient(light=True)
tc.save({"libjepg/conanfile.py": GenConanfile("libjpeg", "0.1"),
"mozjpeg/conanfile.py": GenConanfile("mozjpeg", "0.1").with_provides("libjpeg")})
tc.run("create libjepg")
tc.run("create mozjpeg")

tc.run("graph info --requires=mozjpeg/0.1 --requires=libjpeg/0.1", assert_error=True)
# This used to report that None was provided, but now it reports the name of the provides
assert "ERROR: Provide Conflict: Both 'libjpeg/0.1' and 'mozjpeg/0.1' provide '['libjpeg']'" in tc.out