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

Add info_invalid to graph node serialization #13688

Merged
merged 4 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions conans/client/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def serialize(self):
result["binary"] = self.binary
# TODO: This doesn't match the model, check it
result["invalid_build"] = self.cant_build
result["info_invalid"] = self.conanfile.info.invalid if self.conanfile.info is not None and self.conanfile.info.invalid is not None else False
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
# Adding the conanfile information: settings, options, etc
result.update(self.conanfile.serialize())
result["context"] = self.context
Expand Down
22 changes: 20 additions & 2 deletions conans/test/integration/command/info/info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ class MyTest(ConanFile):
assert recipe["provides"] == ["bar"]




class TestConanfilePath:
def test_cwd(self):
# Check the first positional argument is a relative path
Expand Down Expand Up @@ -356,6 +354,26 @@ def export(self):
assert "ERROR: Package 'dep/0.1' not resolved: dep/0.1: Cannot load" in c.out
assert exit_code == ERROR_GENERAL

def test_invalid_config_validate(self):
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
tc = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
class Pkg(ConanFile):
name = "pkg"
version = "1.0"
options = {"myoption": [True, False]}
default_options = {"myoption": False}
def validate(self):
if self.options.myoption:
raise ConanInvalidConfiguration(f"{self.ref} does not support myoption=True")""")

tc.save({"conanfile.py": conanfile})
tc.run("graph info .")
assert "info_invalid: False" in tc.out
tc.run("graph info . -o 'pkg/1.0:myoption=True'")
assert "info_invalid: pkg/1.0 does not support myoption=True" in tc.out


class TestInfoUpdate:

Expand Down