Skip to content

Commit

Permalink
improved-rdock: new test API (spack#45239)
Browse files Browse the repository at this point in the history
* imoroved-rdock: new test API
* Make test subpart names and or descriptions more accurate

---------

Co-authored-by: Tamara Dahlgren <[email protected]>
  • Loading branch information
AcriusWinter and tldahlgren authored Jul 18, 2024
1 parent a0d62a4 commit 6828a74
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions var/spack/repos/builtin/packages/improved-rdock/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,41 @@ def install(self, spec, prefix):
def setup_run_environment(self, env):
env.set("RBT_ROOT", self.prefix)

def test(self):
def test_rdock(self):
"""improved-rdock test suite"""
copy(join_path(self.prefix.example, "1sj0", "*"), ".")
opts = ["-r", "1sj0_rdock.prm", "-was"]
self.run_test("rbcavity", options=opts)

mpiexe = self.spec["mpi"].prefix.bin.mpirun
opts = [
self.prefix.bin.rbdock,
"-r",
"1sj0_rdock.prm",
"-p",
"dock.prm",
"-n",
"100",
"-i",
"1sj0_ligand.sd",
"-o",
"1sj0_docking_out",
"-s",
"1",
]
self.run_test(str(mpiexe), options=opts)

opts = [join_path(self.test_suite.current_test_data_dir, "test.sh")]
self.run_test("bash", options=opts)

pythonexe = self.spec["python"].command.path
opts = [self.spec.prefix.bin.sdrmsd, "1sj0_ligand.sd", "1sj0_docking_out_sorted.sd"]
expected = ["1\t0.55", "100\t7.91"]
self.run_test(pythonexe, options=opts, expected=expected)

with test_part(self, "test_rdock_rbcavity", purpose="Check rbcavity"):
rbcavity = which("rbcavity")
rbcavity("-r", "1sj0_rdock.prm", "-was")

with test_part(self, "test_rdock_rbdock", purpose="Use mpirun to run rbdock in parallel"):
mpiexe = which(str(self.spec["mpi"].prefix.bin.mpirun))
opts = [
self.prefix.bin.rbdock,
"-r",
"1sj0_rdock.prm",
"-p",
"dock.prm",
"-n",
"100",
"-i",
"1sj0_ligand.sd",
"-o",
"1sj0_docking_out",
"-s",
"1",
]
mpiexe(*opts)

with test_part(self, "test_rdock_test_sh", purpose="Sort the output"):
bash = which("bash")
opts = [join_path(self.test_suite.current_test_data_dir, "test.sh")]
bash(*opts)

with test_part(self, "test_rdock_sdrmsd", purpose="Check sdrmsd calculations"):
pythonexe = which(str(self.spec["python"].command.path))
opts = [self.spec.prefix.bin.sdrmsd, "1sj0_ligand.sd", "1sj0_docking_out_sorted.sd"]
expected = ["1\t0.55", "100\t7.91"]
out = pythonexe(*opts, out=str.split, error=str.split)
check_outputs(expected, out)

0 comments on commit 6828a74

Please sign in to comment.