Skip to content

Commit

Permalink
Add test for the error return
Browse files Browse the repository at this point in the history
  • Loading branch information
IAlibay committed Sep 18, 2024
1 parent 5bc9f96 commit f4a7930
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions openfe/protocols/openmm_rfe/equil_rfe_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,10 +1101,11 @@ def structural_analysis(scratch, shared) -> dict:
analysis_out = scratch / 'structural_analysis.json'

ret = subprocess.run(
['openfe_analysis', # CLI entry point
'RFE_analysis', # CLI option
str(shared), # Where the simulation.nc fille
str(analysis_out) # Where the analysis json file is written
[
'openfe_analysis', # CLI entry point
'RFE_analysis', # CLI option
str(shared), # Where the simulation.nc fille
str(analysis_out) # Where the analysis json file is written
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
Expand Down
12 changes: 12 additions & 0 deletions openfe/tests/protocols/test_openmm_equil_rfe_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from importlib import resources
from unittest import mock
import sys
from pathlib import Path

import mdtraj as mdt
import pytest
Expand Down Expand Up @@ -2103,3 +2104,14 @@ def test_dry_run_complex_alchemwater_totcharge(
assert len(htf._atom_classes['core_atoms']) == core_atoms
assert len(htf._atom_classes['unique_new_atoms']) == new_uniq
assert len(htf._atom_classes['unique_old_atoms']) == old_uniq


def test_structural_analysis_error(tmpdir):

with tmpdir.as_cwd():
ret = openmm_rfe.RelativeHybridTopologyProtocolUnit.structural_analysis(
Path('.'), Path('.')
)

assert 'structural_analysis_error' in ret
assert 'structural_analysis' not in ret

0 comments on commit f4a7930

Please sign in to comment.