Skip to content

Commit 386d62b

Browse files
authored
Fix SBML test suite (#2809)
Don't import from conftest (only use fixtures from there). The imported function is not necessary, though. The IDs already are in the correct format. This was some leftover from earlier days, I think.
1 parent 045dd8c commit 386d62b

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

tests/sbml/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ def pytest_generate_tests(metafunc):
6666
"""Parameterize tests"""
6767

6868
# Run for all SBML semantic test suite cases
69-
if "test_number" in metafunc.fixturenames:
69+
if "test_id" in metafunc.fixturenames:
7070
# Get CLI option
7171
cases = metafunc.config.getoption("cases")
7272
if cases:
7373
# Run selected tests
7474
last_id = int(list(get_all_semantic_case_ids())[-1])
7575
test_numbers = sorted(set(parse_selection(cases, last_id)))
76+
test_ids = map(format_test_id, test_numbers)
7677
else:
7778
# Run all tests
78-
test_numbers = get_all_semantic_case_ids()
79-
test_numbers = map(format_test_id, test_numbers)
80-
metafunc.parametrize("test_number", test_numbers)
79+
test_ids = get_all_semantic_case_ids()
80+
metafunc.parametrize("test_id", test_ids)
8181

8282

8383
def pytest_sessionfinish(session, exitstatus):

tests/sbml/testSBMLSuite.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from amici.constants import SymbolId
2525
from amici.gradient_check import check_derivatives
2626
from numpy.testing import assert_allclose
27-
from tests.sbml.conftest import format_test_id
2827

2928

3029
@pytest.fixture(scope="session")
@@ -45,10 +44,7 @@ def sbml_test_dir():
4544
sys.path = old_path
4645

4746

48-
def test_sbml_testsuite_case(
49-
test_number, result_path, sbml_semantic_cases_dir
50-
):
51-
test_id = format_test_id(test_number)
47+
def test_sbml_testsuite_case(test_id, result_path, sbml_semantic_cases_dir):
5248
model_dir = None
5349

5450
# test cases for which sensitivities are to be checked

tests/sbml/testSBMLSuiteJax.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
find_model_file,
2424
read_settings_file,
2525
)
26-
from tests.sbml.conftest import format_test_id
2726

2827
jax.config.update("jax_enable_x64", True)
2928

@@ -127,9 +126,8 @@ class RData(dict):
127126

128127

129128
def test_sbml_testsuite_case_jax(
130-
test_number, result_path_jax, sbml_semantic_cases_dir
129+
test_id, result_path_jax, sbml_semantic_cases_dir
131130
):
132-
test_id = format_test_id(test_number)
133131
model_dir = Path(__file__).parent / "SBMLTestModelsJax" / test_id
134132
try:
135133
current_test_path = sbml_semantic_cases_dir / test_id

0 commit comments

Comments
 (0)