diff --git a/src/cpp/helpers/ArchiveReader.cpp b/src/cpp/helpers/ArchiveReader.cpp index 9d3a3fcf5..4e198863d 100644 --- a/src/cpp/helpers/ArchiveReader.cpp +++ b/src/cpp/helpers/ArchiveReader.cpp @@ -18,6 +18,12 @@ void ArchiveReader::Create() { } int32_t ArchiveReader::Open() { + if (!std::filesystem::exists(ArchivePath())) { + std::ostringstream errMsg; + errMsg << "Archive: " << ArchivePath().string() << " does not exist" + << std::endl; + throw ArchiveIOGeneralException(MZ_EXIST_ERROR, errMsg.str(), LOGLOCATION); + } auto err = mz_zip_reader_open_file(pmz_zip_reader_instance_, ArchivePath().string().c_str()); if (err != MZ_OK) { diff --git a/tests/end_to_end/cucumber/features/steps/steps.py b/tests/end_to_end/cucumber/features/steps/steps.py index 0ee554db3..2ccf1428b 100644 --- a/tests/end_to_end/cucumber/features/steps/steps.py +++ b/tests/end_to_end/cucumber/features/steps/steps.py @@ -96,14 +96,13 @@ def run_antares_xpansion(context, method, memory=None, n: int = 1): context.return_code = run_command(context.tmp_study, memory=memory, method=method, n_mpi=n, allow_run_as_root=get_conf("allow_run_as_root")) - - output_path = context.tmp_study / "output" - outputs = read_outputs(output_path, use_archive=not memory, lold=True, positive_unsupplied_energy=True) - context.outputs = outputs.out_json - context.options_data = outputs.options_json - context.lold = outputs.lold - context.positive_unsupplied_energy = outputs.positive_unsupplied_energy - print(f"output path is {output_path}") + if context.return_code == 0: # If the simulation failed we're not sur outputs have been generated properly + output_path = context.tmp_study / "output" + outputs = read_outputs(output_path, use_archive=not memory, lold=True, positive_unsupplied_energy=True) + context.outputs = outputs.out_json + context.options_data = outputs.options_json + context.lold = outputs.lold + context.positive_unsupplied_energy = outputs.positive_unsupplied_energy def run_command(study_path, memory, method, n_mpi, allow_run_as_root=False):