diff --git a/src/openfe/tests/protocols/conftest.py b/src/openfe/tests/protocols/conftest.py index cfd225a98..ab1405aa7 100644 --- a/src/openfe/tests/protocols/conftest.py +++ b/src/openfe/tests/protocols/conftest.py @@ -311,17 +311,14 @@ def industry_benchmark_files(): ) -@pytest.fixture -def t4_lysozyme_trajectory_universe(): +# session scope for downstream reuse +@pytest.fixture(scope="session") +def t4_lysozyme_trajectory_dir(): zenodo_restraint_data.fetch("t4_lysozyme_trajectory.zip", processor=pooch.Unzip()) cache_dir = pathlib.Path( POOCH_CACHE / "t4_lysozyme_trajectory.zip.unzip/t4_lysozyme_trajectory" ) - universe = mda.Universe( - str(cache_dir / "t4_toluene_complex.pdb"), - str(cache_dir / "t4_toluene_complex.xtc"), - ) - return universe + return cache_dir RFE_OUTPUT = pooch.create( diff --git a/src/openfe/tests/protocols/restraints/test_geometry_boresch_host.py b/src/openfe/tests/protocols/restraints/test_geometry_boresch_host.py index 1c3121f1f..d511b3d81 100644 --- a/src/openfe/tests/protocols/restraints/test_geometry_boresch_host.py +++ b/src/openfe/tests/protocols/restraints/test_geometry_boresch_host.py @@ -332,8 +332,12 @@ class TestFindAnchorBondedTrajectory(TestFindAnchorMulti): ref_h1h2_distance = 1.55881 @pytest.fixture(scope="class") - def universe(self, t4_lysozyme_trajectory_universe): - universe = t4_lysozyme_trajectory_universe + def universe(self, t4_lysozyme_trajectory_dir): + cache_dir = t4_lysozyme_trajectory_dir + universe = mda.Universe( + str(cache_dir / "t4_toluene_complex.pdb"), + str(cache_dir / "t4_toluene_complex.xtc"), + ) # guess bonds for the protein atoms universe.select_atoms("protein").guess_bonds() return universe diff --git a/src/openfe/tests/protocols/restraints/test_geometry_utils.py b/src/openfe/tests/protocols/restraints/test_geometry_utils.py index 34db6a347..d3cf312b0 100644 --- a/src/openfe/tests/protocols/restraints/test_geometry_utils.py +++ b/src/openfe/tests/protocols/restraints/test_geometry_utils.py @@ -400,6 +400,16 @@ def test_atomgroup_has_bonds(eg5_protein_pdb): assert _atomgroup_has_bonds(ag) +@pytest.fixture() +def t4_lysozyme_trajectory_universe(t4_lysozyme_trajectory_dir): + cache_dir = t4_lysozyme_trajectory_dir + universe = mda.Universe( + str(cache_dir / "t4_toluene_complex.pdb"), + str(cache_dir / "t4_toluene_complex.xtc"), + ) + return universe + + @pytest.mark.skipif( not os.path.exists(POOCH_CACHE) and not HAS_INTERNET, reason="Internet seems to be unavailable and test data is not cached locally.",