test if cache property is not set in config when force_cache
This commit is contained in:
parent
fbc79ced07
commit
db9ab7a1e9
|
@ -4,7 +4,11 @@ from tiramisu import setting
|
|||
setting.expires_time = 1
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.error import ConfigError
|
||||
|
||||
|
||||
from time import sleep, time
|
||||
from py.test import raises
|
||||
|
||||
|
||||
def make_description():
|
||||
|
@ -272,3 +276,6 @@ def test_force_cache():
|
|||
c.cfgimpl_get_values().force_cache()
|
||||
assert c.cfgimpl_get_values()._p_.get_cached(c) == {'u1': ([], None), 'u3': ([], None), 'u2': (None, None)}
|
||||
assert c.cfgimpl_get_settings()._p_.get_cached(c) == {'u4': (set(['disabled']), None), 'u1': (set([]), None), 'u3': (set([]), None), 'u2': (set([]), None)}
|
||||
|
||||
c.cfgimpl_get_settings().remove('cache')
|
||||
raises(ConfigError, "c.cfgimpl_get_values().force_cache()")
|
||||
|
|
|
@ -420,8 +420,8 @@ class Values(object):
|
|||
"""
|
||||
context = self.context()
|
||||
if not 'cache' in context.cfgimpl_get_settings():
|
||||
raise PropertiesOptionError(_('can force cache only if cache '
|
||||
'is actived in config'))
|
||||
raise ConfigError(_('can force cache only if cache '
|
||||
'is actived in config'))
|
||||
#remove all cached properties and value to update "expired" time
|
||||
context.cfgimpl_reset_cache()
|
||||
for path in context.cfgimpl_get_description().impl_getpaths(
|
||||
|
|
Loading…
Reference in New Issue