update test for metaconfig serialization

This commit is contained in:
Emmanuel Garette 2014-02-02 18:33:21 +01:00
parent f8faec408f
commit 26158fc3c4
2 changed files with 2 additions and 5 deletions

View file

@ -5,6 +5,7 @@ from tiramisu.setting import owners
from tiramisu.storage import delete_session from tiramisu.storage import delete_session
from tiramisu.error import ConfigError from tiramisu.error import ConfigError
from pickle import dumps, loads from pickle import dumps, loads
from py.test import raises
def return_value(value=None): def return_value(value=None):
@ -288,9 +289,7 @@ def test_state_metaconfig():
conf2._impl_test = True conf2._impl_test = True
meta = MetaConfig([conf1, conf2], session_id='29090937') meta = MetaConfig([conf1, conf2], session_id='29090937')
meta._impl_test = True meta._impl_test = True
a = dumps(meta) raises(ConfigError, "dumps(meta)")
q = loads(a)
_diff_conf(meta, q)
try: try:
delete_session('29090935') delete_session('29090935')
delete_session('29090936') delete_session('29090936')

View file

@ -540,8 +540,6 @@ class _CommonConfig(SubConfig):
# ----- state # ----- state
def __getstate__(self): def __getstate__(self):
if self._impl_meta is not None: if self._impl_meta is not None:
#FIXME _impl_meta est un weakref => faut pas sauvegarder mais faut bien savoir si c'est un méta ou pas au final ...
#en fait il faut ne pouvoir sérialisé que depuis une MetaConfig ... et pas directement comme pour les options
raise ConfigError('cannot serialize Config with MetaConfig') raise ConfigError('cannot serialize Config with MetaConfig')
slots = set() slots = set()
for subclass in self.__class__.__mro__: for subclass in self.__class__.__mro__: