Skip to content

Commit

Permalink
Use try and except to catch metabolites that are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
hgscott authored and Midnighter committed Nov 11, 2023
1 parent ab0a17d commit 2be2d2f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/memote/suite/tests/test_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ def test_detect_energy_generating_cycles(model, met):
"""
ann = test_detect_energy_generating_cycles.annotation
# Test if the metabolite is present in the model.
main_comp = helpers.find_compartment_id_in_model(model, "c")
if helpers.find_met_in_model(model, met, main_comp)[0] is None:
try:
helpers.find_met_in_model(model, met, main_comp)[0]
except:
pytest.skip(
"This test has been skipped since metabolite {} could "
"not be found in the model.".format(met)
)
# If the metabolite is present, carry out the test.
ann["data"][met] = consistency.detect_energy_generating_cycles(model, met)
# Report the number of cycles scaled by the number of reactions.
ann["metric"][met] = len(ann["data"][met]) / len(model.reactions)
Expand Down

0 comments on commit 2be2d2f

Please sign in to comment.