Skip to content

Commit

Permalink
Adjusted tests to account for different type of exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeByDrescher committed Sep 24, 2024
1 parent beeda7c commit e883234
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion biosimulators_utils/sedml/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ def exec_task(task, variables, preprocessed_task=None, log=None, config=None, **
if str(e) != "":
exceptions.append(e)
msg = 'The SED document did not execute successfully:\n\n {}'.format(
'\n\n '.join(str(exceptions).replace('\n', '\n ') for exceptions in exceptions))
'\n\n '.join(str(exception.__class__) + ":" + str(exception).replace('\n', '\n ')
for exception in exceptions))
raise SedmlExecutionError(msg)
# return the results of the reports
return report_results, log
Expand Down
5 changes: 3 additions & 2 deletions tests/combine/test_combine_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from biosimulators_utils.sedml.data_model import (SedDocument, Task, Report, Model,
ModelLanguage, UniformTimeCourseSimulation, Algorithm, Variable, DataGenerator, DataSet)
from biosimulators_utils.sedml import exec as sedml_exec
from biosimulators_utils.sedml.exceptions import SedmlExecutionError
from biosimulators_utils.sedml.io import SedmlSimulationReader, SedmlSimulationWriter
from biosimulators_utils.viz.data_model import VizFormat
from unittest import mock
Expand Down Expand Up @@ -428,7 +429,7 @@ def sed_task_executer_error(task, variables, log=None, config=None, preprocessed

config.DEBUG = True
sed_doc_executer = functools.partial(sedml_exec.exec_sed_doc, sed_task_executer_error)
with self.assertRaisesRegex(ValueError, 'Big error'):
with self.assertRaisesRegex(SedmlExecutionError, 'Big error'):
exec.exec_sedml_docs_in_archive(sed_doc_executer, archive_filename, out_dir,
apply_xml_model_changes=False,
config=config)
Expand All @@ -453,7 +454,7 @@ def sed_task_executer_error(task, variables, log=None, config=None, preprocessed

config.DEBUG = True
sed_doc_executer = functools.partial(sedml_exec.exec_sed_doc, sed_task_executer_error)
with self.assertRaisesRegex(ValueError, 'Big error'):
with self.assertRaisesRegex(SedmlExecutionError, 'Big error'):
exec.exec_sedml_docs_in_archive(sed_doc_executer, archive_filename, out_dir,
apply_xml_model_changes=False,
config=config)
Expand Down

0 comments on commit e883234

Please sign in to comment.