Skip to content

Commit 2e3e1dc

Browse files
committed
fix test
1 parent 58d3363 commit 2e3e1dc

File tree

2 files changed

+66
-36
lines changed

2 files changed

+66
-36
lines changed

openfe/tests/protocols/openmm_abfe/test_abfe_slow.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
@pytest.mark.integration
14-
@pytest.mark.flaky(reruns=3) # pytest-rerunfailures; we can get bad minimisation
14+
#@pytest.mark.flaky(reruns=3) # pytest-rerunfailures; we can get bad minimisation
1515
@pytest.mark.skipif(not HAS_NAGL, reason="need NAGL")
1616
@pytest.mark.xfail(
1717
HAS_OPENEYE and HAS_NAGL,
@@ -96,16 +96,39 @@ def test_openmm_run_engine(
9696
r = openfe.execute_DAG(dag, shared_basedir=cwd, scratch_basedir=cwd, keep_shared=True)
9797

9898
assert r.ok()
99-
for pur in r.protocol_unit_results:
100-
unit_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
101-
assert unit_shared.exists()
102-
assert pathlib.Path(unit_shared).is_dir()
103-
checkpoint = pur.outputs["last_checkpoint"]
104-
assert checkpoint == f"{pur.outputs['simtype']}_checkpoint.nc"
105-
assert (unit_shared / checkpoint).exists()
106-
nc = pur.outputs["nc"]
107-
assert nc == unit_shared / f"{pur.outputs['simtype']}.nc"
108-
assert nc.exists()
99+
100+
# Check outputs of solvent & complex results
101+
for phase in ["solvent", "complex"]:
102+
purs = [
103+
pur for pur in r.protocol_unit_results
104+
if pur.outputs["simtype"] == phase
105+
]
106+
107+
# get the path to the simulation unit shared dict
108+
for pur in purs:
109+
if "Simulation" in pur.name:
110+
sim_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
111+
assert sim_shared.exists()
112+
assert pathlib.Path(sim_shared).is_dir()
113+
114+
# check the analysis outputs
115+
for pur in purs:
116+
if "Analysis" not in pur.name:
117+
continue
118+
119+
unit_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
120+
assert unit_shared.exists()
121+
assert pathlib.Path(unit_shared).is_dir()
122+
123+
# Does the checkpoint file exist?
124+
checkpoint = pur.outputs["checkpoint"]
125+
assert checkpoint == sim_shared / f"{pur.outputs['simtype']}_checkpoint.nc"
126+
assert checkpoint.exists()
127+
128+
# Does the trajectory file exist?
129+
nc = pur.outputs["trajectory"]
130+
assert nc == sim_shared / f"{pur.outputs['simtype']}.nc"
131+
assert nc.exists()
109132

110133
# Test results methods that need files present
111134
results = protocol.gather([r])

openfe/tests/protocols/openmm_ahfe/test_ahfe_slow.py

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -80,31 +80,38 @@ def test_openmm_run_engine(
8080

8181
assert r.ok()
8282

83-
# get the path to the simulation unit shared dict
84-
for pur in r.protocol_unit_results:
85-
if "Simulation" in pur.name:
86-
sim_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
87-
assert sim_shared.exists()
88-
assert pathlib.Path(sim_shared).is_dir()
89-
90-
# check the analysis outputs
91-
for pur in r.protocol_unit_results:
92-
if "Analysis" not in pur.name:
93-
continue
94-
95-
unit_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
96-
assert unit_shared.exists()
97-
assert pathlib.Path(unit_shared).is_dir()
98-
99-
# Does the checkpoint file exist?
100-
checkpoint = pur.outputs["checkpoint"]
101-
assert checkpoint == sim_shared / f"{pur.outputs['simtype']}_checkpoint.nc"
102-
assert checkpoint.exists()
103-
104-
# Does the trajectory file exist?
105-
nc = pur.outputs["trajectory"]
106-
assert nc == sim_shared / f"{pur.outputs['simtype']}.nc"
107-
assert nc.exists()
83+
# Check outputs of solvent & vacuum results
84+
for phase in ["solvent", "vacuum"]:
85+
purs = [
86+
pur for pur in r.protocol_unit_results
87+
if pur.outputs["simtype"] == phase
88+
]
89+
90+
# get the path to the simulation unit shared dict
91+
for pur in purs:
92+
if "Simulation" in pur.name:
93+
sim_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
94+
assert sim_shared.exists()
95+
assert pathlib.Path(sim_shared).is_dir()
96+
97+
# check the analysis outputs
98+
for pur in purs:
99+
if "Analysis" not in pur.name:
100+
continue
101+
102+
unit_shared = tmpdir / f"shared_{pur.source_key}_attempt_0"
103+
assert unit_shared.exists()
104+
assert pathlib.Path(unit_shared).is_dir()
105+
106+
# Does the checkpoint file exist?
107+
checkpoint = pur.outputs["checkpoint"]
108+
assert checkpoint == sim_shared / f"{pur.outputs['simtype']}_checkpoint.nc"
109+
assert checkpoint.exists()
110+
111+
# Does the trajectory file exist?
112+
nc = pur.outputs["trajectory"]
113+
assert nc == sim_shared / f"{pur.outputs['simtype']}.nc"
114+
assert nc.exists()
108115

109116
# Test results methods that need files present
110117
results = protocol.gather([r])

0 commit comments

Comments
 (0)