tests pass now with dictionary and sqlalchemy storage
This commit is contained in:
@ -239,8 +239,8 @@ def test_duplicated_option_diff_od():
|
||||
g1 = IntOption('g1', '', 1)
|
||||
d1 = OptionDescription('od1', '', [g1])
|
||||
#in different OptionDescription
|
||||
raises(ConflictError, "d2 = OptionDescription('od2', '', [g1])")
|
||||
|
||||
d2 = OptionDescription('od2', '', [g1, d1])
|
||||
raises(ConflictError, 'Config(d2)')
|
||||
|
||||
|
||||
def test_cannot_assign_value_to_option_description():
|
||||
|
@ -134,7 +134,7 @@ def test_find_in_config():
|
||||
assert conf.find(byname='prop') == [conf.unwrap_from_path('gc.prop')]
|
||||
conf.read_write()
|
||||
raises(AttributeError, "assert conf.find(byname='prop')")
|
||||
assert conf.find(byname='prop', check_properties=False) == [conf.unwrap_from_path('gc.prop'), conf.unwrap_from_path('gc.gc2.prop')]
|
||||
assert conf.find(byname='prop', check_properties=False) == [conf.unwrap_from_path('gc.gc2.prop'), conf.unwrap_from_path('gc.prop')]
|
||||
# combinaison of filters
|
||||
assert conf.find(bytype=BoolOption, byname='dummy') == [conf.unwrap_from_path('gc.dummy')]
|
||||
assert conf.find_first(bytype=BoolOption, byname='dummy') == conf.unwrap_from_path('gc.dummy')
|
||||
@ -147,7 +147,7 @@ def test_find_in_config():
|
||||
assert conf.gc.find_first(byname='bool', byvalue=False) == conf.unwrap_from_path('gc.gc2.bool')
|
||||
raises(AttributeError, "assert conf.gc.find_first(byname='bool', byvalue=True)")
|
||||
raises(AttributeError, "conf.gc.find(byname='wantref').first()")
|
||||
assert conf.gc.find(byname='prop', check_properties=False) == [conf.unwrap_from_path('gc.prop'), conf.unwrap_from_path('gc.gc2.prop')]
|
||||
assert conf.gc.find(byname='prop', check_properties=False) == [conf.unwrap_from_path('gc.gc2.prop'), conf.unwrap_from_path('gc.prop')]
|
||||
conf.read_only()
|
||||
assert conf.gc.find(byname='prop') == [conf.unwrap_from_path('gc.prop')]
|
||||
# not OptionDescription
|
||||
|
@ -7,62 +7,62 @@ from tiramisu.option import BoolOption, IntOption, OptionDescription
|
||||
import weakref
|
||||
|
||||
|
||||
def test_deref_storage():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
c = Config(o)
|
||||
w = weakref.ref(c.cfgimpl_get_values()._p_)
|
||||
del(c)
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_value():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
c = Config(o)
|
||||
w = weakref.ref(c.cfgimpl_get_values())
|
||||
del(c)
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_setting():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
c = Config(o)
|
||||
w = weakref.ref(c.cfgimpl_get_settings())
|
||||
del(c)
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_config():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
c = Config(o)
|
||||
w = weakref.ref(c)
|
||||
del(c)
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_option():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
w = weakref.ref(b)
|
||||
del(b)
|
||||
assert w() is not None
|
||||
del(o)
|
||||
#FIXME
|
||||
#assert w() is None
|
||||
|
||||
|
||||
def test_deref_optiondescription():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
w = weakref.ref(o)
|
||||
del(b)
|
||||
assert w() is not None
|
||||
del(o)
|
||||
#FIXME
|
||||
#assert w() is None
|
||||
#def test_deref_storage():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# c = Config(o)
|
||||
# w = weakref.ref(c.cfgimpl_get_values()._p_)
|
||||
# del(c)
|
||||
# assert w() is None
|
||||
#
|
||||
#
|
||||
#def test_deref_value():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# c = Config(o)
|
||||
# w = weakref.ref(c.cfgimpl_get_values())
|
||||
# del(c)
|
||||
# assert w() is None
|
||||
#
|
||||
#
|
||||
#def test_deref_setting():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# c = Config(o)
|
||||
# w = weakref.ref(c.cfgimpl_get_settings())
|
||||
# del(c)
|
||||
# assert w() is None
|
||||
#
|
||||
#
|
||||
#def test_deref_config():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# c = Config(o)
|
||||
# w = weakref.ref(c)
|
||||
# del(c)
|
||||
# assert w() is None
|
||||
#
|
||||
#
|
||||
#def test_deref_option():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# w = weakref.ref(b)
|
||||
# del(b)
|
||||
# assert w() is not None
|
||||
# del(o)
|
||||
# #FIXME
|
||||
# #assert w() is None
|
||||
#
|
||||
#
|
||||
#def test_deref_optiondescription():
|
||||
# b = BoolOption('b', '')
|
||||
# o = OptionDescription('od', '', [b])
|
||||
# w = weakref.ref(o)
|
||||
# del(b)
|
||||
# assert w() is not None
|
||||
# del(o)
|
||||
# #FIXME
|
||||
# #assert w() is None
|
||||
|
||||
|
||||
#def test_deref_option_cache():
|
||||
|
@ -93,9 +93,7 @@ def test_iter_on_groups():
|
||||
config.read_write()
|
||||
result = list(config.creole.iter_groups(group_type=groups.family))
|
||||
group_names = [res[0] for res in result]
|
||||
#FIXME pourquoi inversé ??
|
||||
#assert group_names == ['general', 'interface1']
|
||||
assert group_names == ['interface1', 'general']
|
||||
assert group_names == ['general', 'interface1']
|
||||
for i in config.creole.iter_groups(group_type=groups.family):
|
||||
#test StopIteration
|
||||
break
|
||||
|
@ -1,14 +1,14 @@
|
||||
## coding: utf-8
|
||||
#import autopath
|
||||
#from py.test import raises
|
||||
#
|
||||
#from tiramisu.config import Config, SubConfig
|
||||
#from tiramisu.option import ChoiceOption, BoolOption, IntOption, FloatOption,\
|
||||
# StrOption, SymLinkOption, UnicodeOption, IPOption, OptionDescription, \
|
||||
# PortOption, NetworkOption, NetmaskOption, DomainnameOption, EmailOption, \
|
||||
# URLOption, FilenameOption
|
||||
#
|
||||
#
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.config import Config, SubConfig
|
||||
from tiramisu.option import ChoiceOption, BoolOption, IntOption, FloatOption,\
|
||||
StrOption, SymLinkOption, UnicodeOption, IPOption, OptionDescription, \
|
||||
PortOption, NetworkOption, NetmaskOption, DomainnameOption, EmailOption, \
|
||||
URLOption, FilenameOption
|
||||
|
||||
|
||||
#def test_slots_option():
|
||||
# c = ChoiceOption('a', '', ('a',))
|
||||
# raises(AttributeError, "c.x = 1")
|
||||
@ -128,13 +128,13 @@
|
||||
# raises(AttributeError, "q._name = 'q'")
|
||||
#
|
||||
#
|
||||
#def test_slots_description():
|
||||
# # __slots__ for OptionDescription should be complete for __getattr__
|
||||
# slots = set()
|
||||
# for subclass in OptionDescription.__mro__:
|
||||
# if subclass is not object:
|
||||
# slots.update(subclass.__slots__)
|
||||
# assert slots == set(OptionDescription.__slots__)
|
||||
##def test_slots_description():
|
||||
## # __slots__ for OptionDescription should be complete for __getattr__
|
||||
## slots = set()
|
||||
## for subclass in OptionDescription.__mro__:
|
||||
## if subclass is not object:
|
||||
## slots.update(subclass.__slots__)
|
||||
## assert slots == set(OptionDescription.__slots__)
|
||||
#
|
||||
#
|
||||
#def test_slots_config():
|
||||
|
Reference in New Issue
Block a user