diff options
author | Martin Schulze <37703201+martin-schulze-vireso@users.noreply.github.com> | 2021-09-23 12:12:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 12:12:08 +0200 |
commit | 307a8b40c3fb22761a16e8d9405b2e391a9cc768 (patch) | |
tree | bf2806405f646d79292364468643316f86e2c529 | |
parent | 3ff360a3478fca74c9694139eed0a9166a86988a (diff) |
Improve error message (#9624)
* Improve error message
Otherwise this would only print "ERROR: True"
* add test
Co-authored-by: memsharded <james@conan.io>
-rw-r--r-- | conans/client/graph/graph_builder.py | 3 | ||||
-rw-r--r-- | conans/test/integration/graph/conflict_diamond_test.py | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py index f55d54ee..9f9d3baa 100644 --- a/conans/client/graph/graph_builder.py +++ b/conans/client/graph/graph_builder.py @@ -328,7 +328,8 @@ class DepsGraphBuilder(object): "in your root package." % (consumer_ref, consumer_ref, new_ref, next(iter(previous.dependants)).src, previous.ref, new_ref.name)) - return True + return "Unresolvable conflict between {} and {}".format(previous.ref, new_ref) + # Computed node, if is Editable, has revision=None # If new_ref.revision is None we cannot assume any conflict, the user hasn't specified # a revision, so it's ok any previous_ref diff --git a/conans/test/integration/graph/conflict_diamond_test.py b/conans/test/integration/graph/conflict_diamond_test.py index 998c3833..476c6c1d 100644 --- a/conans/test/integration/graph/conflict_diamond_test.py +++ b/conans/test/integration/graph/conflict_diamond_test.py @@ -4,6 +4,7 @@ import unittest from conans.client.tools import environment_append from conans.paths import CONANFILE +from conans.test.assets.genconanfile import GenConanfile from conans.test.utils.tools import TestClient, load import json @@ -97,3 +98,18 @@ class ConflictDiamondTest(unittest.TestCase): self.assertEqual(hello0["reference"], "Hello0/0.1@lasote/stable") self.assertListEqual(sorted(hello0["required_by"]), sorted(["Hello2/0.1@lasote/stable", "Hello1/0.1@lasote/stable"])) + + +def test_conflict_msg(): + c = TestClient() + c.save({"lib/conanfile.py": GenConanfile(), + "conanfile.txt": textwrap.dedent(""" + [requires] + libdeflate/1.7 + [build_requires] + libdeflate/1.8 + """)}) + c.run("export lib libdeflate/1.7@") + c.run("export lib libdeflate/1.8@") + c.run("install .", assert_error=True) + assert "ERROR: Unresolvable conflict between libdeflate/1.7 and libdeflate/1.8" in c.out |