Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SBML test IDs #2536

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def pytest_generate_tests(metafunc):
else:
# Run all tests
test_numbers = get_all_semantic_case_ids()

test_numbers = map(format_test_id, test_numbers)
metafunc.parametrize("test_number", test_numbers)


Expand All @@ -89,8 +89,6 @@ def pytest_sessionfinish(session, exitstatus):
terminalreporter.ensure_newline()
# parse test names to get passed case IDs (don't know any better way to
# access fixture values)
from testSBMLSuite import format_test_id

passed_ids = [format_test_id(_) for _ in passed_ids]
if passed_ids:
write_passed_tags(passed_ids, terminalreporter)
Expand Down Expand Up @@ -157,3 +155,8 @@ def get_tags_for_test(test_id: str) -> tuple[set[str], set[str]]:
return component_tags, test_tags
print(f"No componentTags or testTags found for test case {test_id}.")
return component_tags, test_tags


def format_test_id(test_id) -> str:
"""Format numeric to 0-padded string"""
return f"{test_id:0>5}"
6 changes: 1 addition & 5 deletions tests/testSBMLSuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from amici.constants import SymbolId
from amici.gradient_check import check_derivatives
from numpy.testing import assert_allclose
from conftest import format_test_id


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -351,8 +352,3 @@ def read_settings_file(current_test_path: Path, test_id: str):
(key, val) = line.split(":")
settings[key] = val.strip()
return settings


def format_test_id(test_id) -> str:
"""Format numeric to 0-padded string"""
return f"{test_id:0>5}"
Loading