add cfg.cache.reset

This commit is contained in:
Emmanuel Garette 2019-02-10 21:14:32 +01:00
parent 9ffd2e6505
commit 688525f98e
3 changed files with 7 additions and 4 deletions

View File

@ -219,7 +219,7 @@ def test_reset_cache():
cfg.option('u1').value.get()
assert 'u1' in values._p_.get_cached()
assert 'u1' in settings._p_.get_cached()
cfg._config_bag.context.cfgimpl_reset_cache(None, None)
cfg.cache.reset()
assert 'u1' not in values._p_.get_cached()
assert 'u1' not in settings._p_.get_cached()
cfg.option('u1').value.get()
@ -231,7 +231,7 @@ def test_reset_cache():
assert 'u1' in settings._p_.get_cached()
assert 'u2' in values._p_.get_cached()
assert 'u2' in settings._p_.get_cached()
cfg._config_bag.context.cfgimpl_reset_cache(None, None)
cfg.cache.reset()
assert 'u1' not in values._p_.get_cached()
assert 'u1' not in settings._p_.get_cached()
assert 'u2' not in values._p_.get_cached()

View File

@ -701,8 +701,6 @@ def test_meta_properties_requires_mandatory():
meta.option('ip_gw').value.set('1.1.1.2')
conf1.option('eth0_method').value.set('dhcp')
conf1.property.read_only()
meta._config_bag.context.cfgimpl_reset_cache(None, None)
conf1._config_bag.context.cfgimpl_reset_cache(None, None)
assert conf1.value.dict(fullpath=True) == {'probes': True, 'eth0_method': 'dhcp', 'ip_address': '1.1.1.1', 'ip_eth0': '1.1.1.1', 'ip_gw': '1.1.1.2'}

View File

@ -1227,6 +1227,11 @@ class _TiramisuContextMetaConfig(_TiramisuContextGroupConfig, _TiramisuContextCo
return Config(self._config_bag.context.pop_config(session_id=session_id))
class TiramisuContextCache(TiramisuContext):
def reset(self):
self._config_bag.context.cfgimpl_reset_cache(None, None)
class TiramisuDispatcher:
pass