From 0ae1b848749c7979922d7465848cd7cd1b1aa35a Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Thu, 30 Jan 2025 14:33:17 +0100 Subject: [PATCH 01/10] Add other unfeasible tests --- .../test_unfeasible_problem.py | 108 +++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index d17f1d43d2..d6eb908b9e 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -64,4 +64,110 @@ def test_unfeasible_problem_01__warning_dry(study_path, check_runner): checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", checks_on_weeks=warnings_on_weeks, simulation=check_runner.get_simulation())) - check_runner.run(checks) \ No newline at end of file + check_runner.run(checks) + + +#def check_all_unfeasible_options(solver_path, study_path, years_error,years_warning): +# output_path = study_path / 'output' + +# st = Study(str(study_path)) +# st.check_files_existence() + +# # Option error-verbose : mps and error +# st.set_variable(variable="include-unfeasible-problem-behavior", value="error-verbose", file_nick_name="general") +# result_code = launch_solver(solver_path, study_path) +# assert result_code != 0 +# check_log_values(output_path, years_error, "fatal") +# check_mps_availability(output_path, years_error) + +# # Option error-dry : no mps and error +# st.set_variable(variable="include-unfeasible-problem-behavior", value="error-dry", file_nick_name="general") +# result_code = launch_solver(solver_path, study_path) +# assert result_code != 0 +# check_log_values(output_path, years_error, "fatal") +# check_no_mps_available(output_path) + +# # Option warning-verbose : mps and warning +# st.set_variable(variable="include-unfeasible-problem-behavior", value="warning-verbose", file_nick_name="general") +# result_code = launch_solver(solver_path, study_path) +# assert result_code == 0 +# check_log_values(output_path, years_warning, "warns") +# check_mps_availability(output_path, years_warning) + +# # Option warning-dry : no mps and warning +# st.set_variable(variable="include-unfeasible-problem-behavior", value="warning-dry", file_nick_name="general") +# result_code = launch_solver(solver_path, study_path) +# assert result_code == 0 +# check_log_values(output_path, years_warning, "warns") +# check_no_mps_available(output_path) + +#@pytest.mark.unfeasible +#@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) +#def test_unfeasible_problem_01(solver_path): +# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} +# years_error = {3: [19]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_02(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_02" +# years_warning = {6: [22,23,29]} +# years_error = {6: [22]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_03(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_03" +# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} +# years_error = {3: [19]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_04(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_04" +# years_warning = {6: [22, 23, 29]} +# years_error = {6: [22]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.medium +#def test_unfeasible_problem_05(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_05" +# #Not all years with errors are tested, there is more than 200 years with errors +# years_warning = {10: [19], 11: [19], 16: [19],29: [19], 41: [42, 43, 49],43: [42, 43, 49],46: [42, 43, 49],142: [42, 43, 49]} +# years_error = {10: [19]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_06(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_06" +# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} +# years_error = {3: [19]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_07(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_07" +# years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} +# years_error = {1: [1]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_08(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_08" +# years_warning = {3: [51],7: [51],9: [51]} +# years_error = {3: [51]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_09(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_09" +# years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} +# years_error = {1: [1]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +#@pytest.mark.unfeasible +#def test_unfeasible_problem_10(solver_path): +# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_10" +# years_warning = {3: [51],7: [51], 9: [51]} +# years_error = {3: [51]} +# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) From 62bc5537ac9327c589372407ed420fa3e362c635 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Thu, 30 Jan 2025 14:39:49 +0100 Subject: [PATCH 02/10] Use correct path --- src/tests/run-study-tests/test_unfeasible_problem.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index d6eb908b9e..4e5a55153c 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -6,14 +6,14 @@ from fixtures import * -ALL_STUDIES_PATH = Path('../resources/Antares_Simulator_Tests').resolve() +ALL_STUDIES_PATH = Path('../resources/Antares_Simulator_Tests_NR/unfeasible-problem').resolve() # -------------------------------------------------------------- # Test behavior when an infeasible problem occurs # -------------------------------------------------------------- @pytest.mark.unfeasible -@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_01"], indirect=True) def test_unfeasible_problem_01__error_verbose(study_path, check_runner): errors_on_weeks = [] errors_on_weeks.append(weeks_in_year(year=3, weeks=[19])) @@ -25,7 +25,7 @@ def test_unfeasible_problem_01__error_verbose(study_path, check_runner): check_runner.run(checks) @pytest.mark.unfeasible -@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_01"], indirect=True) def test_unfeasible_problem_01__error_dry(study_path, check_runner): errors_on_weeks = [] errors_on_weeks.append(weeks_in_year(year=3, weeks=[19])) @@ -37,7 +37,7 @@ def test_unfeasible_problem_01__error_dry(study_path, check_runner): check_runner.run(checks) @pytest.mark.unfeasible -@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_01"], indirect=True) def test_unfeasible_problem_01__warning_verbose(study_path, check_runner): warnings_on_weeks = [] warnings_on_weeks.append(weeks_in_year(year=3, weeks=[19])) @@ -52,7 +52,7 @@ def test_unfeasible_problem_01__warning_verbose(study_path, check_runner): check_runner.run(checks) @pytest.mark.unfeasible -@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_01"], indirect=True) def test_unfeasible_problem_01__warning_dry(study_path, check_runner): warnings_on_weeks = [] warnings_on_weeks.append(weeks_in_year(year=3, weeks=[19])) From 52ee9659dd2bba5b17667f519ad71ec9981914cb Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Thu, 30 Jan 2025 14:40:25 +0100 Subject: [PATCH 03/10] branch main for test_nr --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index 16639d0fb1..d21a60ad75 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,4 @@ [submodule "src/tests/resources/Antares_Simulator_Tests_NR"] path = src/tests/resources/Antares_Simulator_Tests_NR url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR.git + branch = main From d220699048fe597df1b3f8c4efab5546280124d0 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 10:27:58 +0100 Subject: [PATCH 04/10] allow dirty submodule --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index d21a60ad75..0b11b7d0b3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,3 +9,4 @@ path = src/tests/resources/Antares_Simulator_Tests_NR url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR.git branch = main + ignore = dirty From 8c91c149daec59fe1ae79cf233a7ee0b41ddfe64 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 14:22:14 +0100 Subject: [PATCH 05/10] Test 2 and 3 OK --- .../test_unfeasible_problem.py | 193 ++++++++---------- 1 file changed, 89 insertions(+), 104 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index 4e5a55153c..90e1e7dbcb 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -66,108 +66,93 @@ def test_unfeasible_problem_01__warning_dry(study_path, check_runner): simulation=check_runner.get_simulation())) check_runner.run(checks) +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_02"], indirect=True) +def test_unfeasible_problem_02__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=6, weeks=[22,23,29])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_02"], indirect=True) +def test_unfeasible_problem_02__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=6, weeks=[22])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_03"], indirect=True) +def test_unfeasible_problem_03__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=6, weeks=[42,43,49])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=8, weeks=[19])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + +@pytest.mark.unfeasible +def test_unfeasible_problem_04(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_04" + years_warning = {6: [22, 23, 29]} + years_error = {6: [22]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_05(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_05" + #Not all years with errors are tested, there is more than 200 years with errors + years_warning = {10: [19], 11: [19], 16: [19],29: [19], 41: [42, 43, 49],43: [42, 43, 49],46: [42, 43, 49],142: [42, 43, 49]} + years_error = {10: [19]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_06(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_06" + years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} + years_error = {3: [19]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_07(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_07" + years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} + years_error = {1: [1]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_08(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_08" + years_warning = {3: [51],7: [51],9: [51]} + years_error = {3: [51]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_09(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_09" + years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} + years_error = {1: [1]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) + +@pytest.mark.unfeasible +def test_unfeasible_problem_10(solver_path): + study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_10" + years_warning = {3: [51],7: [51], 9: [51]} + years_error = {3: [51]} + check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) -#def check_all_unfeasible_options(solver_path, study_path, years_error,years_warning): -# output_path = study_path / 'output' - -# st = Study(str(study_path)) -# st.check_files_existence() - -# # Option error-verbose : mps and error -# st.set_variable(variable="include-unfeasible-problem-behavior", value="error-verbose", file_nick_name="general") -# result_code = launch_solver(solver_path, study_path) -# assert result_code != 0 -# check_log_values(output_path, years_error, "fatal") -# check_mps_availability(output_path, years_error) - -# # Option error-dry : no mps and error -# st.set_variable(variable="include-unfeasible-problem-behavior", value="error-dry", file_nick_name="general") -# result_code = launch_solver(solver_path, study_path) -# assert result_code != 0 -# check_log_values(output_path, years_error, "fatal") -# check_no_mps_available(output_path) - -# # Option warning-verbose : mps and warning -# st.set_variable(variable="include-unfeasible-problem-behavior", value="warning-verbose", file_nick_name="general") -# result_code = launch_solver(solver_path, study_path) -# assert result_code == 0 -# check_log_values(output_path, years_warning, "warns") -# check_mps_availability(output_path, years_warning) - -# # Option warning-dry : no mps and warning -# st.set_variable(variable="include-unfeasible-problem-behavior", value="warning-dry", file_nick_name="general") -# result_code = launch_solver(solver_path, study_path) -# assert result_code == 0 -# check_log_values(output_path, years_warning, "warns") -# check_no_mps_available(output_path) - -#@pytest.mark.unfeasible -#@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_01"], indirect=True) -#def test_unfeasible_problem_01(solver_path): -# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} -# years_error = {3: [19]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_02(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_02" -# years_warning = {6: [22,23,29]} -# years_error = {6: [22]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_03(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_03" -# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} -# years_error = {3: [19]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_04(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_04" -# years_warning = {6: [22, 23, 29]} -# years_error = {6: [22]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.medium -#def test_unfeasible_problem_05(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_05" -# #Not all years with errors are tested, there is more than 200 years with errors -# years_warning = {10: [19], 11: [19], 16: [19],29: [19], 41: [42, 43, 49],43: [42, 43, 49],46: [42, 43, 49],142: [42, 43, 49]} -# years_error = {10: [19]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_06(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_06" -# years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} -# years_error = {3: [19]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_07(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_07" -# years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} -# years_error = {1: [1]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_08(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_08" -# years_warning = {3: [51],7: [51],9: [51]} -# years_error = {3: [51]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_09(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_09" -# years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} -# years_error = {1: [1]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) - -#@pytest.mark.unfeasible -#def test_unfeasible_problem_10(solver_path): -# study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_10" -# years_warning = {3: [51],7: [51], 9: [51]} -# years_error = {3: [51]} -# check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) From 2a128e8d13fde7e260830cdc5a1725ae9eed2c1d Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 14:36:36 +0100 Subject: [PATCH 06/10] Test 3 and 4 --- .../test_unfeasible_problem.py | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index 90e1e7dbcb..0c4719399f 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -66,6 +66,7 @@ def test_unfeasible_problem_01__warning_dry(study_path, check_runner): simulation=check_runner.get_simulation())) check_runner.run(checks) + @pytest.mark.unfeasible @pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_02"], indirect=True) def test_unfeasible_problem_02__warning_dry(study_path, check_runner): @@ -107,11 +108,42 @@ def test_unfeasible_problem_03__warning_dry(study_path, check_runner): check_runner.run(checks) @pytest.mark.unfeasible -def test_unfeasible_problem_04(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_04" - years_warning = {6: [22, 23, 29]} - years_error = {6: [22]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_03"], indirect=True) +def test_unfeasible_problem_03__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=3, weeks=[19])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_04"], indirect=True) +def test_unfeasible_problem_04__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=6, weeks=[22,23,29])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_04"], indirect=True) +def test_unfeasible_problem_04__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=6, weeks=[22])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + @pytest.mark.unfeasible def test_unfeasible_problem_05(solver_path): From f50437dd6b05a626d07f83ffa33d7017aa36aa31 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 15:16:45 +0100 Subject: [PATCH 07/10] Test 5 and 6 --- .../test_unfeasible_problem.py | 67 ++++++++++++++++--- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index 0c4719399f..a44c09bbda 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -146,19 +146,64 @@ def test_unfeasible_problem_04__error_dry(study_path, check_runner): @pytest.mark.unfeasible -def test_unfeasible_problem_05(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_05" - #Not all years with errors are tested, there is more than 200 years with errors - years_warning = {10: [19], 11: [19], 16: [19],29: [19], 41: [42, 43, 49],43: [42, 43, 49],46: [42, 43, 49],142: [42, 43, 49]} - years_error = {10: [19]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_05"], indirect=True) +def test_unfeasible_problem_05__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=10, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=11, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=16, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=29, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=41, weeks=[42,43,49])) + warnings_on_weeks.append(weeks_in_year(year=43, weeks=[42,43,49])) + warnings_on_weeks.append(weeks_in_year(year=46, weeks=[42,43,49])) + warnings_on_weeks.append(weeks_in_year(year=142, weeks=[42,43,49])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) @pytest.mark.unfeasible -def test_unfeasible_problem_06(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_06" - years_warning = {3: [19], 6: [42, 43, 49], 7: [19], 8: [19]} - years_error = {3: [19]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_05"], indirect=True) +def test_unfeasible_problem_05__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=10, weeks=[19])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_06"], indirect=True) +def test_unfeasible_problem_06__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=6, weeks=[42,43,49])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[19])) + warnings_on_weeks.append(weeks_in_year(year=8, weeks=[19])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_06"], indirect=True) +def test_unfeasible_problem_06__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=3, weeks=[19])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + @pytest.mark.unfeasible def test_unfeasible_problem_07(solver_path): From 8f7633063511c15b43ff159ea803c8563f1d4d0d Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 15:48:41 +0100 Subject: [PATCH 08/10] Test 7 8 --- .../test_unfeasible_problem.py | 61 ++++++++++++++++--- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index a44c09bbda..180ea31a9a 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -204,20 +204,61 @@ def test_unfeasible_problem_06__error_dry(study_path, check_runner): simulation=check_runner.get_simulation())) check_runner.run(checks) +pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_07"], indirect=True) +def test_unfeasible_problem_07__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=1, weeks=[1])) + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[52])) + warnings_on_weeks.append(weeks_in_year(year=5, weeks=[1])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[52])) + warnings_on_weeks.append(weeks_in_year(year=9, weeks=[52])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) @pytest.mark.unfeasible -def test_unfeasible_problem_07(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_07" - years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} - years_error = {1: [1]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_07"], indirect=True) +def test_unfeasible_problem_07__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=1, weeks=[1])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + + +pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_08"], indirect=True) +def test_unfeasible_problem_08__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[51])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[51])) + warnings_on_weeks.append(weeks_in_year(year=9, weeks=[51])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) @pytest.mark.unfeasible -def test_unfeasible_problem_08(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_08" - years_warning = {3: [51],7: [51],9: [51]} - years_error = {3: [51]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_08"], indirect=True) +def test_unfeasible_problem_08__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=3, weeks=[51])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + @pytest.mark.unfeasible def test_unfeasible_problem_09(solver_path): From fa05e5a3fbd35eb018b1b47af309d21c6a13f821 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 15:51:35 +0100 Subject: [PATCH 09/10] test 9 10 --- .../test_unfeasible_problem.py | 64 +++++++++++++++---- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/src/tests/run-study-tests/test_unfeasible_problem.py b/src/tests/run-study-tests/test_unfeasible_problem.py index 180ea31a9a..6875f2765b 100644 --- a/src/tests/run-study-tests/test_unfeasible_problem.py +++ b/src/tests/run-study-tests/test_unfeasible_problem.py @@ -204,7 +204,7 @@ def test_unfeasible_problem_06__error_dry(study_path, check_runner): simulation=check_runner.get_simulation())) check_runner.run(checks) -pytest.mark.unfeasible +@pytest.mark.unfeasible @pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_07"], indirect=True) def test_unfeasible_problem_07__warning_dry(study_path, check_runner): warnings_on_weeks = [] @@ -233,7 +233,7 @@ def test_unfeasible_problem_07__error_dry(study_path, check_runner): check_runner.run(checks) -pytest.mark.unfeasible +@pytest.mark.unfeasible @pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_08"], indirect=True) def test_unfeasible_problem_08__warning_dry(study_path, check_runner): warnings_on_weeks = [] @@ -261,16 +261,56 @@ def test_unfeasible_problem_08__error_dry(study_path, check_runner): @pytest.mark.unfeasible -def test_unfeasible_problem_09(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_09" - years_warning = {1: [1], 3: [52], 5: [1], 7: [52], 9: [52]} - years_error = {1: [1]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_09"], indirect=True) +def test_unfeasible_problem_09__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=1, weeks=[1])) + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[52])) + warnings_on_weeks.append(weeks_in_year(year=5, weeks=[1])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[52])) + warnings_on_weeks.append(weeks_in_year(year=9, weeks=[52])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_09"], indirect=True) +def test_unfeasible_problem_09__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=1, weeks=[1])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) + + +@pytest.mark.unfeasible +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_10"], indirect=True) +def test_unfeasible_problem_10__warning_dry(study_path, check_runner): + warnings_on_weeks = [] + warnings_on_weeks.append(weeks_in_year(year=3, weeks=[51])) + warnings_on_weeks.append(weeks_in_year(year=7, weeks=[51])) + warnings_on_weeks.append(weeks_in_year(year=9, weeks=[51])) + + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="warning-dry", + checks_on_weeks=warnings_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) @pytest.mark.unfeasible -def test_unfeasible_problem_10(solver_path): - study_path = ALL_STUDIES_PATH / "specific-tests" / "unfeasible-problem" / "unfeasible_problem_10" - years_warning = {3: [51],7: [51], 9: [51]} - years_error = {3: [51]} - check_all_unfeasible_options(solver_path, study_path, years_error, years_warning) +@pytest.mark.parametrize('study_path', [ALL_STUDIES_PATH / "unfeasible_problem_10"], indirect=True) +def test_unfeasible_problem_10__error_dry(study_path, check_runner): + errors_on_weeks = [] + errors_on_weeks.append(weeks_in_year(year=3, weeks=[51])) + checks = check_list() + checks.add(check = unfeasible_problem(study_path, new_behavior="error-dry", + checks_on_weeks=errors_on_weeks, + simulation=check_runner.get_simulation())) + check_runner.run(checks) From 37085ba576a9ba414f3b6eb314a2ff8d5e8fef15 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 31 Jan 2025 15:52:25 +0100 Subject: [PATCH 10/10] update test nr --- src/tests/resources/Antares_Simulator_Tests_NR | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/resources/Antares_Simulator_Tests_NR b/src/tests/resources/Antares_Simulator_Tests_NR index f1fa5377eb..0a08ac83d8 160000 --- a/src/tests/resources/Antares_Simulator_Tests_NR +++ b/src/tests/resources/Antares_Simulator_Tests_NR @@ -1 +1 @@ -Subproject commit f1fa5377eb6e35ae0d021f9cd5fe21443796d737 +Subproject commit 0a08ac83d8a687911862272924a21a065efae866