Merge branch 'master' into develop

This commit is contained in:
Emmanuel Garette 2019-10-20 08:24:48 +02:00
commit c75425c03a
3 changed files with 10 additions and 2 deletions

View file

@ -45,6 +45,9 @@ def test_multi_parents_path_same():
assert metacfg2.config.path() == 'metacfg1.metacfg2'
assert metacfg3.config.path() == 'metacfg1.metacfg3'
assert cfg1.config.path() == 'metacfg1.metacfg3.metacfg1.metacfg2.cfg1'
metacfg1.option('od1.i1').value.set(1)
metacfg3.option('od1.i1').value.set(2)
assert cfg1.option('od1.i1').value.get() == 1
orideep = cfg1.config.deepcopy(metaconfig_prefix="test_", session_id='test_cfg1')
deep = orideep
while True:
@ -55,11 +58,11 @@ def test_multi_parents_path_same():
assert len(children) < 2
deep = children[0]
assert deep.config.path() == 'test_metacfg3.test_metacfg1.test_metacfg2.test_cfg1'
assert cfg1.option('od1.i1').value.get() == 1
del orideep
raises(ConfigError, "deep.config.path()")
def test_multi_parents_value():
metacfg1 = make_metaconfig()
cfg1 = metacfg1.config.new(type='config', session_id="cfg1")

View file

@ -51,4 +51,4 @@ allfuncs.extend(all_options)
del(all_options)
__all__ = tuple(allfuncs)
del(allfuncs)
__version__ = "3.0rc14"
__version__ = "3.0rc15"

View file

@ -1446,6 +1446,11 @@ class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextCon
"""Add config from MetaConfig"""
self._config_bag.context.add_config(config)
def parents(self):
"""Get all parents of current config"""
for parent in self._config_bag.context.get_parents():
yield self._return_config(parent)
class _TiramisuContextMetaConfig(_TiramisuContextMixConfig):
"""Actions to MetaConfig"""