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 test with python_requires options values example #13487

Merged
Merged
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
38 changes: 38 additions & 0 deletions conans/test/integration/py_requires/python_requires_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down