From e021e26d5aa18034917b0ad8fa0264b5d66f2f97 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 13 Sep 2018 22:01:27 +0200 Subject: [PATCH] coverage --- test/test_dyn_optiondescription.py | 1 - test/test_storage.py | 15 +++++++++++++++ tiramisu/option/syndynoptiondescription.py | 3 --- tiramisu/storage/dictionary/__init__.py | 5 ++--- tiramisu/storage/dictionary/storage.py | 6 +----- tiramisu/storage/dictionary/value.py | 5 +---- tiramisu/storage/sqlite3/value.py | 3 --- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/test_dyn_optiondescription.py b/test/test_dyn_optiondescription.py index 42dcfcb..b2c3416 100644 --- a/test/test_dyn_optiondescription.py +++ b/test/test_dyn_optiondescription.py @@ -10,7 +10,6 @@ from tiramisu import BoolOption, StrOption, ChoiceOption, IPOption, \ OptionDescription, DynOptionDescription, DynSymLinkOption, submulti, MasterSlaves, \ Config, Params, ParamOption, ParamValue from tiramisu.error import PropertiesOptionError, ConfigError, ConflictError -from tiramisu.storage import delete_session from py.test import raises diff --git a/test/test_storage.py b/test/test_storage.py index c4b5882..a7edc80 100644 --- a/test/test_storage.py +++ b/test/test_storage.py @@ -27,6 +27,21 @@ def test_list(): assert 'test_non_persistent' not in list_sessions('config') +def test_delete_not_persisten(): + b = BoolOption('b', '') + o = OptionDescription('od', '', [b]) + try: + Config(o, session_id='test_persistent', persistent=True) + except: + c = Config(o, session_id='not_test_persistent') + assert list_sessions('all') == ['not_test_persistent'] + del c + assert list_sessions('all') == [] + # + c = Config(o, session_id='not_test_persistent') + raises(ValueError, "delete_session('not_test_persistent')") + + def test_create_persistent(): b = BoolOption('b', '') o = OptionDescription('od', '', [b]) diff --git a/tiramisu/option/syndynoptiondescription.py b/tiramisu/option/syndynoptiondescription.py index 8a6cf0d..219f5a4 100644 --- a/tiramisu/option/syndynoptiondescription.py +++ b/tiramisu/option/syndynoptiondescription.py @@ -103,9 +103,6 @@ class SynDynOptionDescription(object): def impl_get_display_name(self): return self._opt.impl_get_display_name() + self._suffix - def impl_getdoc(self): - return self._opt.impl_getdoc() + self._suffix - def reset_cache(self, path, values, diff --git a/tiramisu/storage/dictionary/__init__.py b/tiramisu/storage/dictionary/__init__.py index 5d1a79f..ff61b50 100644 --- a/tiramisu/storage/dictionary/__init__.py +++ b/tiramisu/storage/dictionary/__init__.py @@ -24,7 +24,6 @@ use it. But if something goes wrong, you will lost your modifications. """ from .value import Values from .setting import Properties, Permissives -from .storage import setting, Storage, list_sessions, delete_session +from .storage import setting, Storage, list_sessions -__all__ = ('setting', 'Values', 'Properties', 'Permissives', 'Storage', 'list_sessions', - 'delete_session') +__all__ = ('setting', 'Values', 'Properties', 'Permissives', 'Storage', 'list_sessions') diff --git a/tiramisu/storage/dictionary/storage.py b/tiramisu/storage/dictionary/storage.py index 32c5747..2aef94f 100644 --- a/tiramisu/storage/dictionary/storage.py +++ b/tiramisu/storage/dictionary/storage.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # ____________________________________________________________ from ...i18n import _ -from ...error import ConfigError, ConflictError +from ...error import ConflictError class Setting(object): @@ -32,10 +32,6 @@ def list_sessions(): # pragma: optional cover return _list_sessions -def delete_session(session_id): # pragma: optional cover - raise ConfigError(_('dictionary storage cannot delete session')) - - class Storage(object): __slots__ = ('session_id', 'persistent') storage = 'dictionary' diff --git a/tiramisu/storage/dictionary/value.py b/tiramisu/storage/dictionary/value.py index 674b350..9289327 100644 --- a/tiramisu/storage/dictionary/value.py +++ b/tiramisu/storage/dictionary/value.py @@ -41,9 +41,6 @@ class Values(Cache): def commit(self): pass - def getsession(self): - pass - def _setvalue_info(self, nb, idx, value, values, index, vidx): lst = list(self._values[nb]) if idx is None: @@ -299,4 +296,4 @@ class Values(Cache): self._values = export def delete_session(session_id): - raise ValueError(_('a dictionary cannot be persistent')) + raise ValueError(_('cannot delete none persistent session')) diff --git a/tiramisu/storage/sqlite3/value.py b/tiramisu/storage/sqlite3/value.py index de1d70d..915e429 100644 --- a/tiramisu/storage/sqlite3/value.py +++ b/tiramisu/storage/sqlite3/value.py @@ -34,9 +34,6 @@ class Values(Sqlite3DB): """ super(Values, self).__init__(storage) - def getsession(self): - pass - # sqlite def _sqlite_select(self, path, index): request = "SELECT value FROM value WHERE path = ? AND session_id = ? "