can retrieve metaconfig/mixconfig/config in a metaconfig/mixconfig
This commit is contained in:
parent
07e6ea5eb2
commit
aa11e3b79c
|
@ -1140,3 +1140,12 @@ def test_metaconfig_force_metaconfig_on_freeze_option():
|
||||||
config.option('dummy1').property.pop('frozen')
|
config.option('dummy1').property.pop('frozen')
|
||||||
assert config.option('dummy1').value.get() == 'config'
|
assert config.option('dummy1').value.get() == 'config'
|
||||||
assert config.option('dummy1').owner.get() == 'config'
|
assert config.option('dummy1').owner.get() == 'config'
|
||||||
|
|
||||||
|
|
||||||
|
def test_meta_get_config():
|
||||||
|
od = make_description()
|
||||||
|
meta = MetaConfig(['name1', 'name2'], optiondescription=od)
|
||||||
|
meta.config.new('meta1', type='metaconfig')
|
||||||
|
assert isinstance(meta.config.get('meta1'), MetaConfig)
|
||||||
|
assert isinstance(meta.config.get('name1'), Config)
|
||||||
|
raises(ConfigError, "meta.config.get('unknown')")
|
||||||
|
|
|
@ -1129,3 +1129,14 @@ def test_meta_new_mixconfig():
|
||||||
conf = Config(od, session_id='conf1')
|
conf = Config(od, session_id='conf1')
|
||||||
meta = MetaConfig([conf])
|
meta = MetaConfig([conf])
|
||||||
assert isinstance(meta.config.new('mixconfig', type="mixconfig"), MixConfig)
|
assert isinstance(meta.config.new('mixconfig', type="mixconfig"), MixConfig)
|
||||||
|
|
||||||
|
|
||||||
|
def test_meta_get_mixconfig():
|
||||||
|
od = make_description()
|
||||||
|
conf = Config(od, session_id='conf1')
|
||||||
|
meta = MetaConfig([conf])
|
||||||
|
meta.config.new('mixconfig', type="mixconfig")
|
||||||
|
assert isinstance(meta.config.get('mixconfig'), MixConfig)
|
||||||
|
raises(ConfigError, "meta.config.get('unknown')")
|
||||||
|
meta.config.get('mixconfig').config.add(MixConfig(od, [], session_id='mixconfig2'))
|
||||||
|
assert isinstance(meta.config.get('mixconfig').config.get('mixconfig2'), MixConfig)
|
||||||
|
|
|
@ -1339,6 +1339,10 @@ class _TiramisuContextGroupConfig(TiramisuContext):
|
||||||
def path(self):
|
def path(self):
|
||||||
return self._config_bag.context.cfgimpl_get_config_path()
|
return self._config_bag.context.cfgimpl_get_config_path()
|
||||||
|
|
||||||
|
def get(self,
|
||||||
|
name: str) -> 'Config':
|
||||||
|
return self._return_config(self._config_bag.context.getconfig(name))
|
||||||
|
|
||||||
|
|
||||||
class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextConfigReset):
|
class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextConfigReset):
|
||||||
"""Actions to MixConfig"""
|
"""Actions to MixConfig"""
|
||||||
|
|
Loading…
Reference in New Issue