Skip to content

Commit 721c0ed

Browse files
authored
Separate v1 and v2 tests (#284)
Move tests to v1 and v2 subpackages as done for the library. Also improve error handling for incorrect SBML models / paths.
1 parent 56b67ea commit 721c0ed

22 files changed

+17
-11
lines changed

petab/v1/sbml.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,16 @@ def load_sbml_from_file(
213213
:param sbml_file: Filename of the SBML file
214214
:return: The SBML reader, document, model
215215
"""
216+
if not Path(sbml_file).is_file():
217+
raise FileNotFoundError(f"File not found: {sbml_file}")
218+
216219
sbml_reader = libsbml.SBMLReader()
217220
sbml_document = sbml_reader.readSBML(sbml_file)
218221
sbml_model = sbml_document.getModel()
219222

223+
if sbml_model is None:
224+
raise ValueError(f"SBML model could not be loaded from {sbml_file}")
225+
220226
return sbml_reader, sbml_document, sbml_model
221227

222228

tests/v1/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# import fixtures
1111
pytest_plugins = [
12-
"tests.test_petab",
12+
"tests.v1.test_petab",
1313
]
1414

1515

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# import fixtures
1414
pytest_plugins = [
15-
"tests.test_petab",
15+
"tests.v1.test_petab",
1616
]
1717

1818

@@ -427,8 +427,8 @@ def test_petablint_succeeds():
427427
"""Run petablint and ensure we exit successfully for a file that should
428428
contain no errors
429429
"""
430-
dir_isensee = "../doc/example/example_Isensee/"
431-
dir_fujita = "../doc/example/example_Fujita/"
430+
dir_isensee = "../../doc/example/example_Isensee/"
431+
dir_fujita = "../../doc/example/example_Fujita/"
432432

433433
# run with measurement file
434434
script_path = os.path.abspath(os.path.dirname(__file__))

0 commit comments

Comments
 (0)