diff --git a/tests/cobra.py b/tests/cobra.py index 97b43f2..2eec347 100644 --- a/tests/cobra.py +++ b/tests/cobra.py @@ -1,5 +1,6 @@ import cobra import json +from pathlib import Path def loadYaml(model_name): print('load yaml') @@ -34,7 +35,10 @@ def loadMatlab(model_name): is_valid = False errors = '' try: - cobra.io.load_matlab_model(model_name + '.mat') + data_dir = Path(".") / ".." + data_dir = data_dir.resolve() + model_path = data_dir / "{}.mat".format(model_name) + cobra.io.load_matlab_model(str(model_path.resolve())) is_valid = True except FileNotFoundError: errors = "File missing" @@ -61,9 +65,10 @@ def loadJson(model_name): def validateSbml(model_name): print('validate sbml with cobrapy') is_valid = False + errors = '' try: _, result = cobra.io.sbml.validate_sbml_model(model_name + '.xml') - if result == {}: + if result['SBML_FATAL'] == [] and result['SBML_ERROR'] == [] and result['SBML_SCHEMA_ERROR'] == [] and result['COBRA_FATAL'] == [] and result['COBRA_ERROR'] == []: is_valid = True else: raise Exception(result)