Skip to content

Commit

Permalink
Merge branch 'dev' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Jan 4, 2021
2 parents 63c0682 + 4600c39 commit 2e13006
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion biosimulators_test_suite/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.9'
__version__ = '0.1.10'
29 changes: 28 additions & 1 deletion biosimulators_test_suite/test_case/published_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..data_model import (TestCase, SedTaskRequirements, ExpectedSedReport, ExpectedSedPlot,
AlertType, OutputMedium)
from ..exceptions import InvalidOuputsException, SkippedTestCaseException
from ..warnings import IgnoredTestCaseWarning, SimulatorRuntimeErrorWarning, InvalidOuputsWarning
from ..warnings import IgnoredTestCaseWarning, SimulatorRuntimeErrorWarning, InvalidOuputsWarning, TestCaseWarning
from .utils import are_array_shapes_equivalent
from biosimulators_utils.combine.data_model import CombineArchive, CombineArchiveContentFormatPattern # noqa: F401
from biosimulators_utils.combine.io import CombineArchiveReader, CombineArchiveWriter
Expand Down Expand Up @@ -951,6 +951,33 @@ def modify_simulation(self, simulation):
"""
pass # pragma: no cover

@property
def report_error_as_warning(self):
return False

def eval(self, specifications):
""" Evaluate a simulator's performance on a test case
Args:
specifications (:obj:`dict`): specifications of the simulator to validate
Returns:
:obj:`object`: data returned by :obj:`eval_outputs`
Raises:
:obj:`Exception`: if the simulator did not pass the test case
"""
try:
return_value = super(UniformTimeCourseTestCase, self).eval(specifications)
except Exception as exception:
if self.report_error_as_warning:
warnings.warn(str(exception), TestCaseWarning)
return_value = False
else:
raise

return return_value

def eval_outputs(self, specifications, synthetic_archive, synthetic_sed_docs, outputs_dir):
""" Test that the expected outputs were created for the synthetic archive
Expand Down
4 changes: 4 additions & 0 deletions biosimulators_test_suite/test_case/sedml.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ def modify_simulation(self, simulation):
class SimulatorSupportsUniformTimeCoursesWithNonZeroInitialTimes(UniformTimeCourseTestCase):
""" Test that a simulator supports multiple time courses with non-zero initial times """

@property
def report_error_as_warning(self):
return True

def modify_simulation(self, simulation):
""" Modify a simulation
Expand Down
10 changes: 8 additions & 2 deletions tests/test_case/test_sedml.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from biosimulators_test_suite.exceptions import InvalidOuputsException
from biosimulators_test_suite.test_case import sedml
from biosimulators_test_suite.test_case.published_project import SimulatorCanExecutePublishedProject, SyntheticCombineArchiveTestCase
from biosimulators_test_suite.warnings import IgnoredTestCaseWarning, InvalidOuputsWarning
from biosimulators_test_suite.warnings import IgnoredTestCaseWarning, InvalidOuputsWarning, TestCaseWarning
from biosimulators_utils.archive.data_model import Archive, ArchiveFile
from biosimulators_utils.archive.io import ArchiveWriter
from biosimulators_utils.config import get_config
Expand Down Expand Up @@ -374,6 +374,11 @@ def test_SimulatorSupportsUniformTimeCoursesWithNonZeroInitialTimes(self):
published_projects_test_cases=[curated_case])
self.assertTrue(case.eval(specs))

with mock.patch('biosimulators_utils.simulator.exec.exec_sedml_docs_in_archive_with_containerized_simulator',
side_effect=Exception('Simulation failed')):
with self.assertWarns(TestCaseWarning):
self.assertFalse(case.eval(specs))

def test_SimulatorProducesLinear2DPlots_eval_outputs(self):
case = sedml.SimulatorProducesLinear2DPlots()

Expand Down Expand Up @@ -541,7 +546,8 @@ def test_SimulatorProducesReportsWithCuratedNumberOfDimensions(self):
})
self.assertTrue(case.is_curated_sed_algorithm_suitable_for_building_synthetic_archive(specs, alg))

with mock.patch.object(SyntheticCombineArchiveTestCase, 'is_curated_sed_algorithm_suitable_for_building_synthetic_archive', return_value=False):
with mock.patch.object(SyntheticCombineArchiveTestCase,
'is_curated_sed_algorithm_suitable_for_building_synthetic_archive', return_value=False):
self.assertFalse(case.is_curated_sed_algorithm_suitable_for_building_synthetic_archive(specs, alg))

# eval_outputs
Expand Down

0 comments on commit 2e13006

Please sign in to comment.