diff --git a/test/test_cache.py b/test/test_cache.py index ef4f1a3..e1cd609 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -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()") diff --git a/tiramisu/value.py b/tiramisu/value.py index c07ddfc..a82e1a4 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -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(