Skip to content

Commit

Permalink
skip_on_valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Jan 16, 2024
1 parent 80bce27 commit 06c899e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/tests/petab/test_petab_problem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from amici.petab.petab_problem import PetabProblem
from benchmark_models_petab import get_problem
from amici.testing import skip_on_valgrind


@skip_on_valgrind
def test_amici_petab_problem_pregenerate():
"""PetabProblem with pre-generated ExpDatas"""
# any example is fine - the only assumption is that we don't have
Expand Down Expand Up @@ -29,6 +31,7 @@ def test_amici_petab_problem_pregenerate():
assert edata.parameters[0] == 0.12345


@skip_on_valgrind
def test_amici_petab_problem_on_demand():
"""PetabProblem with on-demand ExpDatas"""
# any example is fine - the only assumption is that we don't have
Expand Down Expand Up @@ -64,6 +67,7 @@ def test_amici_petab_problem_on_demand():
)


@skip_on_valgrind
def test_amici_petab_problem_pregenerate_equals_on_demand():
"""Check that PetabProblem produces the same ExpDatas
independent of the `store_edatas` parameter."""
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_antimony_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import numpy as np
from amici.antimony_import import antimony2amici
from amici.testing import TemporaryDirectoryWinSafe as TemporaryDirectory
from amici.testing import skip_on_valgrind


@skip_on_valgrind
def test_antimony_example():
"""If this example requires changes, please also update documentation/python_interface.rst."""
ant_model = """
Expand Down
3 changes: 3 additions & 0 deletions python/tests/test_compare_conservation_laws_sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from amici.testing import skip_on_valgrind


@pytest.fixture
Expand Down Expand Up @@ -123,6 +124,7 @@ def get_results(
return amici.runAmiciSimulation(model, solver, edata)


@skip_on_valgrind
def test_compare_conservation_laws_sbml(models, edata_fixture):
# first, create the model
model_with_cl, model_without_cl = models
Expand Down Expand Up @@ -288,6 +290,7 @@ def test_adjoint_pre_and_post_equilibration(models, edata_fixture):
assert_allclose(raa_cl["sllh"], raa["sllh"], 1e-5, 1e-5)


@skip_on_valgrind
def test_get_set_model_settings(models):
"""test amici.(get|set)_model_settings cycles for models with and without
conservation laws"""
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_cxxcodeprinter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import sympy as sp
from amici.cxxcodeprinter import AmiciCxxCodePrinter
from sympy.codegen.rewriting import optims_c99
from amici.testing import skip_on_valgrind


@skip_on_valgrind
def test_optimizations():
"""Check that AmiciCxxCodePrinter handles optimizations correctly."""
try:
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_de_model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import sympy as sp
from amici.de_model import Event
from amici.import_utils import amici_time_symbol
from amici.testing import skip_on_valgrind


@skip_on_valgrind
def test_event_trigger_time():
e = Event(
sp.Symbol("event1"), "event name", amici_time_symbol - 10, sp.Float(0)
Expand Down
1 change: 1 addition & 0 deletions python/tests/test_ode_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_csc_matrix_vector():
assert str(sparse_matrix) == "Matrix([[0], [da2_db_1]])"


@skip_on_valgrind
def test_match_deriv():
from amici.de_export import DERIVATIVE_PATTERN as pat

Expand Down
3 changes: 3 additions & 0 deletions python/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import amici
import numpy as np
import pytest
from amici.testing import skip_on_valgrind


# test parameters for test_pandas_import_export
combos = itertools.product([(10, 5), (5, 10), ()], repeat=3)
Expand All @@ -18,6 +20,7 @@
]


@skip_on_valgrind
@pytest.mark.parametrize("case", cases)
def test_pandas_import_export(sbml_example_presimulation_module, case):
"""TestCase class for testing csv import using pandas"""
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_petab_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest
from amici.petab.petab_import import import_petab_problem
from amici.petab.simulations import SLLH, simulate_petab
from amici.testing import skip_on_valgrind

# Absolute and relative tolerances for finite difference gradient checks.
ATOL: float = 1e-3
Expand All @@ -29,6 +30,7 @@ def lotka_volterra() -> petab.Problem:
)


@skip_on_valgrind
def test_simulate_petab_sensitivities(lotka_volterra):
petab_problem = lotka_volterra
amici_model = import_petab_problem(petab_problem)
Expand Down
3 changes: 3 additions & 0 deletions python/tests/test_rdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from amici.numpy import evaluate
from numpy.testing import assert_almost_equal, assert_array_equal
from amici.testing import skip_on_valgrind


@pytest.fixture(scope="session")
Expand All @@ -19,6 +20,7 @@ def rdata_by_id_fixture(sbml_example_presimulation_module):
return model, rdata


@skip_on_valgrind
def test_rdata_by_id(rdata_by_id_fixture):
model, rdata = rdata_by_id_fixture

Expand All @@ -42,6 +44,7 @@ def test_rdata_by_id(rdata_by_id_fixture):
)


@skip_on_valgrind
def test_evaluate(rdata_by_id_fixture):
# get IDs of model components
model, rdata = rdata_by_id_fixture
Expand Down
3 changes: 3 additions & 0 deletions python/tests/test_sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ def _test_set_parameters_by_dict(model_module):
assert model.getParameters() == old_parameter_values


@skip_on_valgrind
@pytest.mark.parametrize("extract_cse", [True, False])
def test_code_gen_uses_cse(extract_cse):
"""Check that code generation honors AMICI_EXTRACT_CSE"""
Expand All @@ -675,6 +676,7 @@ def test_code_gen_uses_cse(extract_cse):
os.environ = old_environ


@skip_on_valgrind
def test_code_gen_uses_lhs_symbol_ids():
"""Check that code generation uses symbol IDs instead of plain array
indices"""
Expand All @@ -691,6 +693,7 @@ def test_code_gen_uses_lhs_symbol_ids():
assert "dobservable_x1_dx1 = " in dwdx


@skip_on_valgrind
def test_hardcode_parameters(simple_sbml_model):
"""Test model generation works for model without observables"""
sbml_doc, sbml_model = simple_sbml_model
Expand Down

0 comments on commit 06c899e

Please sign in to comment.