From a6807f250d500eec0be5780233a40487a939b137 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 25 Nov 2024 23:05:40 +0100 Subject: [PATCH] .. --- python/tests/test_edata.py | 2 ++ python/tests/test_sbml_import.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/python/tests/test_edata.py b/python/tests/test_edata.py index fab49c160e..1e63b1c126 100644 --- a/python/tests/test_edata.py +++ b/python/tests/test_edata.py @@ -2,11 +2,13 @@ import amici import numpy as np +import pytest from amici.testing import skip_on_valgrind from test_sbml_import import model_units_module # noqa: F401 @skip_on_valgrind +@pytest.mark.usefixtures("model_units_module") def test_edata_sensi_unscaling(model_units_module): # noqa: F811 """ ExpData parameters should be used for unscaling initial state diff --git a/python/tests/test_sbml_import.py b/python/tests/test_sbml_import.py index 77bcaf34c1..b09257d3a1 100644 --- a/python/tests/test_sbml_import.py +++ b/python/tests/test_sbml_import.py @@ -2,6 +2,7 @@ import os import re +import sys from numbers import Number from pathlib import Path @@ -109,7 +110,7 @@ def test_nosensi(simple_sbml_model): assert rdata.status == amici.AMICI_ERROR -@pytest.fixture +@pytest.fixture(scope="session") def observable_dependent_error_model(simple_sbml_model): sbml_doc, sbml_model = simple_sbml_model # add parameter and rate rule @@ -776,13 +777,13 @@ def test_constraints(): @skip_on_valgrind -def test_same_extension_warning(): +def test_same_extension_error(): """Test for error when loading a model with the same extension name as an already loaded model.""" from amici.antimony_import import antimony2amici ant_model_1 = """ - model test_same_extension_warning + model test_same_extension_error species A = 0 p = 1 A' = p @@ -807,6 +808,14 @@ def test_same_extension_warning(): module_name=module_name, module_path=outdir ) assert model_module_1.get_model().getParameters()[0] == 1.0 + + # Try to import another model with the same name + + # On Windows, this will give "permission denied" when building the + # extension + if sys.platform == "win32": + return + antimony2amici( ant_model_2, model_name=module_name,