feat: test with numeric/boolean style string

This commit is contained in:
egarette@silique.fr 2025-09-30 06:25:50 +02:00
parent 7f62590085
commit 0929c86af6
2 changed files with 13 additions and 5 deletions

View file

@ -61,7 +61,7 @@ def get_rougail_config(test_dir, namespace=False, relative_to=None):
return rougailconfig
def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unrestraint=True):
def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unrestraint=True, exclude_namespace=None):
# level is "all" or "mandatories"
if use_unrestraint:
@ -77,7 +77,7 @@ def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unre
else:
only = True
values = {}
get_variables(root_config, root_config, values, only, excludes, specify_dynamic_id, use_unrestraint)
get_variables(root_config, root_config, values, only, excludes, specify_dynamic_id, use_unrestraint, exclude_namespace)
if not specify_dynamic_id:
for exclude in excludes:
_values = values
@ -177,8 +177,10 @@ def get_value(variable, index, excludes, config, use_unrestraint):
return tests
def get_variables(root_config, config, values, only, excludes, specify_dynamic_id, use_unrestraint, *, index=None, leader_is_mandatory=False):
def get_variables(root_config, config, values, only, excludes, specify_dynamic_id, use_unrestraint, exclude_namespace, *, index=None, leader_is_mandatory=False):
for idx, key in enumerate(config):
if key.name() == exclude_namespace:
continue
if not use_unrestraint and 'hidden' in key.property.get():
continue
if key.isoptiondescription():
@ -194,14 +196,14 @@ def get_variables(root_config, config, values, only, excludes, specify_dynamic_i
has_value = False
for idx_, val in enumerate(leader_value):
value.append({})
get_variables(root_config, key, value[-1], only, excludes, specify_dynamic_id, use_unrestraint, index=idx_, leader_is_mandatory=leader_is_mandatory)
get_variables(root_config, key, value[-1], only, excludes, specify_dynamic_id, use_unrestraint, None, index=idx_, leader_is_mandatory=leader_is_mandatory)
if value[-1]:
has_value = True
if has_value:
values[key.name()] = value
else:
value = {}
get_variables(root_config, key, value, only, excludes, specify_dynamic_id, use_unrestraint)
get_variables(root_config, key, value, only, excludes, specify_dynamic_id, use_unrestraint, None)
if value:
values[key.name()] = value
else:

View file

@ -15,3 +15,9 @@ var6:
description: the sixth variable
type: string
default: value
var7:
description: the seventh variable
default: '8080'
var8:
description: the height variable
default: 'true'