From b2b3408d2ef655c178fa17d48e7dcc95b67072f9 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 20 Mar 2023 21:38:51 +0100 Subject: [PATCH] add test with python_requires options values example --- .../py_requires/python_requires_test.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/conans/test/integration/py_requires/python_requires_test.py b/conans/test/integration/py_requires/python_requires_test.py index 9c5e66428b6..7ffb09291a5 100644 --- a/conans/test/integration/py_requires/python_requires_test.py +++ b/conans/test/integration/py_requires/python_requires_test.py @@ -737,6 +737,44 @@ def build_id(self): self.assertIn("pkg/0.1@user/testing: My cool package!", client.out) self.assertIn("pkg/0.1@user/testing: My cool package_info!", client.out) + def test_options_errors(self): + c = TestClient() + base = textwrap.dedent(""" + from conan import ConanFile + class BaseConan: + options = {"base": [True, False]} + default_options = {"base": True} + + class PyReq(ConanFile): + name = "base" + version = "1.0.0" + package_type = "python-require" + """) + derived = textwrap.dedent(""" + import conan + + class DerivedConan(conan.ConanFile): + name = "derived" + python_requires = "base/1.0.0" + python_requires_extend = "base.BaseConan" + options = {"derived": [True, False]} + default_options = {"derived": False} + + def init(self): + base = self.python_requires["base"].module.BaseConan + self.options.update(base.options, base.default_options) + + def generate(self): + self.output.info(f"OptionBASE: {self.options.base}") + self.output.info(f"OptionDERIVED: {self.options.derived}") + """) + c.save({"base/conanfile.py": base, + "derived/conanfile.py": derived}) + c.run("create base") + c.run("install derived") + assert "OptionBASE: True" in c.out + assert "OptionDERIVED: False" in c.out + def test_transitive_python_requires(): # https://github.com/conan-io/conan/issues/8546