From 61d96ba6ce9676ae20fe4f50d200a89b40b74ad0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 10 Oct 2025 08:01:45 +0200 Subject: [PATCH] fix: update test --- pyproject.toml | 3 --- .../04_5disabled_calculation_boolean/errors/all.json | 6 ++++++ .../errors/mandatories.json | 6 ++++++ .../test/04_5disabled_calculation_boolean/file/all.env | 3 +++ .../file/all_exclude.env | 3 +++ .../file/mandatories.env | 2 ++ .../04_5disabled_calculation_boolean/makedict/all.json | 4 ++++ .../makedict/mandatories.json | 4 ++++ .../04_5disabled_calculation_boolean/errors/all.json | 6 ++++++ .../errors/mandatories.json | 6 ++++++ .../04_5disabled_calculation_boolean/file/all.env | 3 +++ .../file/all_exclude.env | 3 +++ .../file/mandatories.env | 2 ++ .../04_5disabled_calculation_boolean/makedict/all.json | 4 ++++ .../makedict/mandatories.json | 4 ++++ tests/test_load.py | 10 +++++----- 16 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 tests/results/test/04_5disabled_calculation_boolean/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_boolean/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_boolean/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_boolean/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_boolean/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_boolean/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_boolean/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/mandatories.json diff --git a/pyproject.toml b/pyproject.toml index 2d8ea69..c72759d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,9 +13,6 @@ license = {file = "LICENSE"} classifiers = [ "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", diff --git a/tests/results/test/04_5disabled_calculation_boolean/errors/all.json b/tests/results/test/04_5disabled_calculation_boolean/errors/all.json new file mode 100644 index 0000000..abb7924 --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/errors/all.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"variable2\" (a seconde variable) is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test/04_5disabled_calculation_boolean/errors/mandatories.json b/tests/results/test/04_5disabled_calculation_boolean/errors/mandatories.json new file mode 100644 index 0000000..abb7924 --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/errors/mandatories.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"variable2\" (a seconde variable) is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test/04_5disabled_calculation_boolean/file/all.env b/tests/results/test/04_5disabled_calculation_boolean/file/all.env new file mode 100644 index 0000000..3da85df --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/file/all.env @@ -0,0 +1,3 @@ +ROUGAIL_CONDITION="string1" +ROUGAIL_VARIABLE1="string1" +ROUGAIL_VARIABLE2="string1" diff --git a/tests/results/test/04_5disabled_calculation_boolean/file/all_exclude.env b/tests/results/test/04_5disabled_calculation_boolean/file/all_exclude.env new file mode 100644 index 0000000..3da85df --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/file/all_exclude.env @@ -0,0 +1,3 @@ +ROUGAIL_CONDITION="string1" +ROUGAIL_VARIABLE1="string1" +ROUGAIL_VARIABLE2="string1" diff --git a/tests/results/test/04_5disabled_calculation_boolean/file/mandatories.env b/tests/results/test/04_5disabled_calculation_boolean/file/mandatories.env new file mode 100644 index 0000000..39a8f11 --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/file/mandatories.env @@ -0,0 +1,2 @@ +ROUGAIL_VARIABLE1="string1" +ROUGAIL_VARIABLE2="string1" diff --git a/tests/results/test/04_5disabled_calculation_boolean/makedict/all.json b/tests/results/test/04_5disabled_calculation_boolean/makedict/all.json new file mode 100644 index 0000000..17e88c5 --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/makedict/all.json @@ -0,0 +1,4 @@ +{ + "condition": "string1", + "variable1": "string1" +} diff --git a/tests/results/test/04_5disabled_calculation_boolean/makedict/mandatories.json b/tests/results/test/04_5disabled_calculation_boolean/makedict/mandatories.json new file mode 100644 index 0000000..6111101 --- /dev/null +++ b/tests/results/test/04_5disabled_calculation_boolean/makedict/mandatories.json @@ -0,0 +1,4 @@ +{ + "condition": "no", + "variable1": "string1" +} diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/all.json b/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/all.json new file mode 100644 index 0000000..104ea62 --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/all.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"rougail.variable2\" (a seconde variable) is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/mandatories.json b/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/mandatories.json new file mode 100644 index 0000000..104ea62 --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/errors/mandatories.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"rougail.variable2\" (a seconde variable) is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all.env b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all.env new file mode 100644 index 0000000..54e3f9e --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all.env @@ -0,0 +1,3 @@ +ROUGAIL.CONDITION="string1" +ROUGAIL.VARIABLE1="string1" +ROUGAIL.VARIABLE2="string1" diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all_exclude.env b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all_exclude.env new file mode 100644 index 0000000..54e3f9e --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/all_exclude.env @@ -0,0 +1,3 @@ +ROUGAIL.CONDITION="string1" +ROUGAIL.VARIABLE1="string1" +ROUGAIL.VARIABLE2="string1" diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/file/mandatories.env b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/mandatories.env new file mode 100644 index 0000000..d67f722 --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/file/mandatories.env @@ -0,0 +1,2 @@ +ROUGAIL.VARIABLE1="string1" +ROUGAIL.VARIABLE2="string1" diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/all.json b/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/all.json new file mode 100644 index 0000000..7cebec1 --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/all.json @@ -0,0 +1,4 @@ +{ + "rougail.condition": "string1", + "rougail.variable1": "string1" +} diff --git a/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/mandatories.json b/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/mandatories.json new file mode 100644 index 0000000..dfcc3b1 --- /dev/null +++ b/tests/results/test_namespace/04_5disabled_calculation_boolean/makedict/mandatories.json @@ -0,0 +1,4 @@ +{ + "rougail.condition": "no", + "rougail.variable1": "string1" +} diff --git a/tests/test_load.py b/tests/test_load.py index b6b59a9..89d235a 100644 --- a/tests/test_load.py +++ b/tests/test_load.py @@ -50,8 +50,8 @@ def _test_structural_files(test_dir, namespace, ext, *, level, need_exclude=Fals config = rougail.run() ################################## root_path = Path('tests') / 'results' / dir_name / test_dir.name - makedict = root_path / 'makedict' / f'{level}.json' - filename = root_path / 'file' + makedict = root_path / 'makedict' / f'{level}.json' + filename = root_path / 'file' if need_exclude: filename = filename / f'{level}_exclude.{EXT}' else: @@ -66,8 +66,8 @@ def _test_structural_files(test_dir, namespace, ext, *, level, need_exclude=Fals generated_user_data = RougailUserData(config, rougailconfig=rougailconfig).run() errors = rougail.user_datas(generated_user_data) #expected output - expected_file = Path('tests') / 'results' / dir_name / test_dir.name / 'makedict' / f'{level}.json' - with open(expected_file) as json_file: + expected_filename = Path('tests') / 'results' / dir_name / test_dir.name / 'makedict' / f'{level}.json' + with expected_filename.open() as json_file: expected = load(json_file) # here is the effective test errors_file = Path('tests') / 'results' / dir_name / test_dir.name / 'errors' / f'{level}.json' @@ -85,7 +85,7 @@ def _test_structural_files(test_dir, namespace, ext, *, level, need_exclude=Fals # config.property.read_only() config_dict = dict(config_to_dict(config.value.get())) - assert expected == config_dict, expected_file + assert expected == config_dict, expected_filename ###################################### #teardown: set the original environement again os.environ = save.copy()