48 lines
2.0 KiB
Python
48 lines
2.0 KiB
Python
#this test is much more to test that **it's there** and answers attribute access
|
|
import autopath
|
|
from py.test import raises
|
|
|
|
from tiramisu.config import *
|
|
from tiramisu.option import *
|
|
|
|
def make_description():
|
|
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
|
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
|
gcdummy2 = BoolOption('hide', 'dummy', default=True)
|
|
objspaceoption = ChoiceOption('objspace', 'Object space',
|
|
['std', 'thunk'], 'std')
|
|
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
|
intoption = IntOption('int', 'Test int option', default=0)
|
|
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
|
stroption = StrOption('str', 'Test string option', default="abc")
|
|
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
|
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
|
wantframework_option = BoolOption('wantframework', 'Test requires',
|
|
default=False)
|
|
|
|
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption, gcdummy2])
|
|
descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
|
wantref_option, stroption,
|
|
wantframework_option,
|
|
intoption, boolop])
|
|
return descr
|
|
|
|
def test_base_config_and_groups():
|
|
descr = make_description()
|
|
# overrides the booloption default value
|
|
config = Config(descr, bool=False)
|
|
assert config.gc.hide == True
|
|
|
|
def test_root_config_answers_ok():
|
|
"if you hide the root config, the options in this namespace behave normally"
|
|
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
|
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
|
descr = OptionDescription('tiramisu', '', [gcdummy, boolop])
|
|
cfg = Config(descr)
|
|
cfg.cfgimpl_hide()
|
|
assert cfg.dummy == False
|
|
assert cfg.boolop == True
|
|
|
|
|
|
|