From d55d93f05152c7621a955b38ca8d149714d903fb Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 18 Oct 2023 16:30:50 +0100 Subject: [PATCH] Test generic solvate function as well as specialised tip3p function. --- tests/Sandpit/Exscientia/Solvent/test_solvent.py | 12 +++++++++--- tests/Solvent/test_solvent.py | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/Sandpit/Exscientia/Solvent/test_solvent.py b/tests/Sandpit/Exscientia/Solvent/test_solvent.py index f3a0b8978..e4fb56b26 100644 --- a/tests/Sandpit/Exscientia/Solvent/test_solvent.py +++ b/tests/Sandpit/Exscientia/Solvent/test_solvent.py @@ -1,11 +1,13 @@ import pytest import tempfile +from functools import partial + from sire.legacy.IO import GroTop import BioSimSpace.Sandpit.Exscientia as BSS -from tests.Sandpit.Exscientia.conftest import has_gromacs +from tests.conftest import has_gromacs @pytest.fixture(scope="module") @@ -18,8 +20,12 @@ def system(): @pytest.mark.parametrize("match_water", [True, False]) +@pytest.mark.parametrize( + "function", + [partial(BSS.Solvent.solvate, "tip3p"), BSS.Solvent.tip3p], +) @pytest.mark.skipif(not has_gromacs, reason="Requires GROMACS to be installed") -def test_crystal_water(system, match_water): +def test_crystal_water(system, match_water, function): """ Test that user defined crystal waters can be preserved during solvation and on write to GroTop format. @@ -35,7 +41,7 @@ def test_crystal_water(system, match_water): box, angles = BSS.Box.cubic(5.5 * BSS.Units.Length.nanometer) # Create the solvated system. - solvated = BSS.Solvent.tip3p(system, box, angles, match_water=match_water) + solvated = function(system, box, angles, match_water=match_water) # Search for the crystal waters in the solvated system. try: diff --git a/tests/Solvent/test_solvent.py b/tests/Solvent/test_solvent.py index 7edf20cbf..185bb6373 100644 --- a/tests/Solvent/test_solvent.py +++ b/tests/Solvent/test_solvent.py @@ -1,6 +1,8 @@ import pytest import tempfile +from functools import partial + from sire.legacy.IO import GroTop import BioSimSpace as BSS @@ -18,8 +20,12 @@ def system(): @pytest.mark.parametrize("match_water", [True, False]) +@pytest.mark.parametrize( + "function", + [partial(BSS.Solvent.solvate, "tip3p"), BSS.Solvent.tip3p], +) @pytest.mark.skipif(not has_gromacs, reason="Requires GROMACS to be installed") -def test_crystal_water(system, match_water): +def test_crystal_water(system, match_water, function): """ Test that user defined crystal waters can be preserved during solvation and on write to GroTop format. @@ -35,7 +41,7 @@ def test_crystal_water(system, match_water): box, angles = BSS.Box.cubic(5.5 * BSS.Units.Length.nanometer) # Create the solvated system. - solvated = BSS.Solvent.tip3p(system, box, angles, match_water=match_water) + solvated = function(system, box, angles, match_water=match_water) # Search for the crystal waters in the solvated system. try: