From 4e1053bba91b7a637396f9e48937a9e5b5d18de0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 4 Jul 2024 19:55:49 +0200 Subject: [PATCH] calculation with self information and symlink --- tests/test_config.py | 13 ++++++++++++- tiramisu/option/optiondescription.py | 9 ++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 5107f15..d6bfc2f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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) diff --git a/tiramisu/option/optiondescription.py b/tiramisu/option/optiondescription.py index 85b1942..6ed9344 100644 --- a/tiramisu/option/optiondescription.py +++ b/tiramisu/option/optiondescription.py @@ -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,10 +94,9 @@ 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) + properties = option.impl_getproperties() + if 'force_store_value' in properties: + force_store_values.append(option) if option.impl_is_readonly(): raise ConflictError(_('duplicate option: {0}').format(option)) if not self.impl_is_readonly() and display_name: