error in external function should returns only ConfigError
This commit is contained in:
@ -993,9 +993,9 @@ def test_callback_raise():
|
||||
cfg.read_write()
|
||||
try:
|
||||
cfg.od1.opt1
|
||||
except Exception, err:
|
||||
except ConfigError, err:
|
||||
assert '"Option 1"' in str(err)
|
||||
try:
|
||||
cfg.od2.opt2
|
||||
except ValueError, err:
|
||||
except ConfigError, err:
|
||||
assert '"Option 2"' in str(err)
|
||||
|
@ -7,7 +7,7 @@ from py.test import raises
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import BoolOption, StrOption, OptionDescription
|
||||
from tiramisu.setting import groups
|
||||
from tiramisu.error import ValueWarning
|
||||
from tiramisu.error import ValueWarning, ConfigError
|
||||
from tiramisu.i18n import _
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ def test_validator_params_value_values_index_slave():
|
||||
|
||||
|
||||
def test_validator_params_value_values_notmulti():
|
||||
raises(TypeError, "opt1 = StrOption('opt1', '', validator=value_values, default='val')")
|
||||
raises(ConfigError, "opt1 = StrOption('opt1', '', validator=value_values, default='val')")
|
||||
|
||||
|
||||
def test_validator_params_value_values_kwargs_empty():
|
||||
@ -286,7 +286,7 @@ def test_validator_params_context():
|
||||
|
||||
def test_validator_params_key():
|
||||
opt1 = StrOption('opt1', '', validator=return_true, validator_params={'param': ('yes',)}, default='val')
|
||||
raises(TypeError, "StrOption('opt2', '', validator=return_true, validator_params={'param_unknown': ('yes',)}, default='val')")
|
||||
raises(ConfigError, "StrOption('opt2', '', validator=return_true, validator_params={'param_unknown': ('yes',)}, default='val')")
|
||||
root = OptionDescription('root', '', [opt1])
|
||||
cfg = Config(root)
|
||||
assert cfg.opt1 == 'val'
|
||||
|
Reference in New Issue
Block a user