do not duplicate valid_consistency

This commit is contained in:
Emmanuel Garette 2018-09-05 20:22:53 +02:00
parent 1816813f92
commit 7fa9b0637e
1 changed files with 15 additions and 7 deletions

View File

@ -305,11 +305,12 @@ class Option(OnlyOption):
do_validation(val, do_validation(val,
idx) idx)
self.valid_consistency(option_bag, if not is_warnings_only or not check_error:
value, self.valid_consistency(option_bag,
context, value,
check_error, context,
is_warnings_only) check_error,
is_warnings_only)
except ValueError as err: except ValueError as err:
#raise err #raise err
if debug: # pragma: no cover if debug: # pragma: no cover
@ -476,7 +477,14 @@ class Option(OnlyOption):
cconfig_bag = option_bag.config_bag.copy() cconfig_bag = option_bag.config_bag.copy()
cconfig_bag.properties = cconfig_bag.properties - {'warnings'} cconfig_bag.properties = cconfig_bag.properties - {'warnings'}
cconfig_bag.set_permissive() cconfig_bag.set_permissive()
if not option_bag.fromconsistency:
fromconsistency_is_empty = True
option_bag.fromconsistency = [cons_id for cons_id, f, a, p in consistencies]
else:
fromconsistency_is_empty = False
for cons_id, func, all_cons_opts, params in consistencies: for cons_id, func, all_cons_opts, params in consistencies:
if not fromconsistency_is_empty and cons_id in option_bag.fromconsistency:
return
warnings_only = option_warnings_only or params.get('warnings_only', False) warnings_only = option_warnings_only or params.get('warnings_only', False)
if (warnings_only and not check_error) or (not warnings_only and check_error): if (warnings_only and not check_error) or (not warnings_only and check_error):
transitive = params.get('transitive', True) transitive = params.get('transitive', True)
@ -500,6 +508,8 @@ class Option(OnlyOption):
warnings_only, warnings_only,
transitive, transitive,
cconfig_bag) cconfig_bag)
if fromconsistency_is_empty:
option_bag.fromconsistency = []
def _get_consistency_value(self, def _get_consistency_value(self,
option_bag, option_bag,
@ -574,8 +584,6 @@ class Option(OnlyOption):
:param transitive: propertyerror is transitive :param transitive: propertyerror is transitive
:type transitive: `boolean` :type transitive: `boolean`
""" """
if cons_id in option_bag.fromconsistency:
return
all_cons_vals = [] all_cons_vals = []
all_cons_opts = [] all_cons_opts = []
length = None length = None