1010url = BSS .tutorialUrl ()
1111
1212
13- def test_flex_align ():
14- # Load the ligands.
15- s0 = BSS .IO .readMolecules ([f"{ url } /ligand01.prm7.bz2" , f"{ url } /ligand01.rst7.bz2" ])
16- s1 = BSS .IO .readMolecules ([f"{ url } /ligand02.prm7.bz2" , f"{ url } /ligand02.rst7.bz2" ])
13+ @pytest .fixture (scope = "session" )
14+ def system0 ():
15+ return BSS .IO .readMolecules (
16+ [f"{ url } /ligand01.prm7.bz2" , f"{ url } /ligand01.rst7.bz2" ]
17+ )
18+
19+
20+ @pytest .fixture (scope = "session" )
21+ def system1 ():
22+ return BSS .IO .readMolecules (
23+ [f"{ url } /ligand02.prm7.bz2" , f"{ url } /ligand02.rst7.bz2" ]
24+ )
25+
1726
27+ def test_flex_align (system0 , system1 ):
1828 # Extract the molecules.
19- m0 = s0 .getMolecules ()[0 ]
20- m1 = s1 .getMolecules ()[0 ]
29+ m0 = system0 .getMolecules ()[0 ]
30+ m1 = system1 .getMolecules ()[0 ]
2131
2232 # Get the best mapping between the molecules that contains the prematch.
2333 mapping = BSS .Align .matchAtoms (
@@ -50,14 +60,10 @@ def test_flex_align():
5060
5161# Parameterise the function with a set of valid atom pre-matches.
5262@pytest .mark .parametrize ("prematch" , [{3 : 1 }, {5 : 9 }, {4 : 5 }, {1 : 0 }])
53- def test_prematch (prematch ):
54- # Load the ligands.
55- s0 = BSS .IO .readMolecules ([f"{ url } /ligand01.prm7.bz2" , f"{ url } /ligand01.rst7.bz2" ])
56- s1 = BSS .IO .readMolecules ([f"{ url } /ligand02.prm7.bz2" , f"{ url } /ligand02.rst7.bz2" ])
57-
63+ def test_prematch (system0 , system1 , prematch ):
5864 # Extract the molecules.
59- m0 = s0 .getMolecules ()[0 ]
60- m1 = s1 .getMolecules ()[0 ]
65+ m0 = system0 .getMolecules ()[0 ]
66+ m1 = system1 .getMolecules ()[0 ]
6167
6268 # Get the best mapping between the molecules that contains the prematch.
6369 mapping = BSS .Align .matchAtoms (
@@ -71,14 +77,10 @@ def test_prematch(prematch):
7177
7278# Parameterise the function with a set of invalid atom pre-matches.
7379@pytest .mark .parametrize ("prematch" , [{- 1 : 1 }, {50 : 9 }, {4 : 48 }, {1 : - 1 }])
74- def test_invalid_prematch (prematch ):
75- # Load the ligands.
76- s0 = BSS .IO .readMolecules ([f"{ url } /ligand01.prm7.bz2" , f"{ url } /ligand01.rst7.bz2" ])
77- s1 = BSS .IO .readMolecules ([f"{ url } /ligand02.prm7.bz2" , f"{ url } /ligand02.rst7.bz2" ])
78-
80+ def test_invalid_prematch (system0 , system1 , prematch ):
7981 # Extract the molecules.
80- m0 = s0 .getMolecules ()[0 ]
81- m1 = s1 .getMolecules ()[0 ]
82+ m0 = system0 .getMolecules ()[0 ]
83+ m1 = system1 .getMolecules ()[0 ]
8284
8385 # Assert that the invalid prematch raises a ValueError.
8486 with pytest .raises (ValueError ):
@@ -264,16 +266,14 @@ def test_merge():
264266
265267@pytest .fixture (scope = "module" )
266268def roi_mol0 ():
267- return BSS .IO .readMolecules (
268- BSS .IO .glob ("test/Sandpit/Exscientia/input/ligands/wild*" )
269- )[0 ]
269+ files = BSS .IO .expand (url , ["wild.prmtop" , "wild.inpcrd" ], ".bz2" )
270+ return BSS .IO .readMolecules (files )[0 ]
270271
271272
272273@pytest .fixture (scope = "module" )
273274def roi_mol1 ():
274- return BSS .IO .readMolecules (
275- BSS .IO .glob ("test/Sandpit/Exscientia/input/ligands/mutated*" )
276- )[0 ]
275+ files = BSS .IO .expand (url , ["mutated.prmtop" , "mutated.inpcrd" ], ".bz2" )
276+ return BSS .IO .readMolecules (files )[0 ]
277277
278278
279279@pytest .fixture (scope = "module" )
0 commit comments