calculation with self information and symlink

This commit is contained in:
egarette@silique.fr 2024-07-04 19:55:49 +02:00
parent 897d4dd216
commit 4e1053bba9
2 changed files with 16 additions and 6 deletions

View file

@ -9,7 +9,7 @@ do_autopath()
from .config import config_type, get_config, value_list, global_owner
import pytest
from tiramisu import Config
from tiramisu import Config, Calculation, Params, ParamSelfInformation, calc_value
from tiramisu.i18n import _
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined
@ -217,6 +217,17 @@ def test_information_option_2():
# assert not list_sessions()
def test_information_option_symlink():
i1 = IntOption('test1', '', Calculation(calc_value, Params(ParamSelfInformation('info'))), informations={'info': 'value'})
i2 = SymLinkOption('test2', i1)
od1 = OptionDescription('test', '', [i2, i1])
cfg = Config(od1)
# it's tuples
assert set(cfg.option('test1').information.list()) == {'info', 'doc'}
assert set(cfg.option('test2').information.list()) == {'info', 'doc'}
# assert not list_sessions()
def test_information_optiondescription():
od1 = make_description()
cfg = Config(od1)

View file

@ -86,7 +86,7 @@ class CacheOptionDescription(BaseOption):
force_store_values,
dependencies_information,
)
else:
elif not option.impl_is_symlinkoption():
informations = option.get_dependencies_information()
if informations:
for param in informations.pop(None):
@ -94,7 +94,6 @@ class CacheOptionDescription(BaseOption):
for information, options in option.get_dependencies_information().items():
if None in options:
dependencies_information.setdefault(information, []).append(option)
if not option.impl_is_symlinkoption():
properties = option.impl_getproperties()
if 'force_store_value' in properties:
force_store_values.append(option)