@@ -832,6 +832,49 @@ def generate(self):
832
832
assert "OptionBASE: True" in c .out
833
833
assert "OptionDERIVED: False" in c .out
834
834
835
+ def test_options_default_update (self ):
836
+ c = TestClient (light = True )
837
+ base = textwrap .dedent ("""
838
+ from conan import ConanFile
839
+ class BaseConan:
840
+ options = {"base": [True, False]}
841
+ default_options = {"base": True}
842
+
843
+ class PyReq(ConanFile):
844
+ name = "base"
845
+ version = "1.0.0"
846
+ package_type = "python-require"
847
+ """ )
848
+ derived = textwrap .dedent ("""
849
+ import conan
850
+
851
+ class DerivedConan(conan.ConanFile):
852
+ name = "derived"
853
+ python_requires = "base/1.0.0"
854
+ python_requires_extend = "base.BaseConan"
855
+ options = {"derived": [True, False]}
856
+ default_options = {"derived": False}
857
+
858
+ def init(self):
859
+ base = self.python_requires["base"].module.BaseConan
860
+ self.options.update(base.options, base.default_options)
861
+ self.options.base = False
862
+
863
+ def generate(self):
864
+ self.output.info(f"OptionBASE: {self.options.base}")
865
+ self.output.info(f"OptionDERIVED: {self.options.derived}")
866
+ """ )
867
+ c .save ({"base/conanfile.py" : base ,
868
+ "derived/conanfile.py" : derived })
869
+ c .run ("create base" )
870
+ c .run ("install derived" )
871
+ assert "OptionBASE: False" in c .out
872
+ assert "OptionDERIVED: False" in c .out
873
+
874
+ c .run ("install derived -o=&:base=True" )
875
+ assert "OptionBASE: True" in c .out
876
+ assert "OptionDERIVED: False" in c .out
877
+
835
878
836
879
def test_transitive_python_requires ():
837
880
# https://github.com/conan-io/conan/issues/8546
0 commit comments