Skip to content
Snippets Groups Projects
Commit 09240f59 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

make HHblits tests agnostic of any scicore specific env variables

Futhermore we only want to run the unit tests if an HHblits 3 installation
is detected.
parent 1d214599
Branches
Tags
No related merge requests found
...@@ -11,6 +11,7 @@ import datetime ...@@ -11,6 +11,7 @@ import datetime
import ost import ost
from ost import seq from ost import seq
from ost import settings
from ost.bindings import hhblits from ost.bindings import hhblits
class _UnitTestHHblitsLog(ost.LogSink): class _UnitTestHHblitsLog(ost.LogSink):
...@@ -33,7 +34,9 @@ def setUpModule(): ...@@ -33,7 +34,9 @@ def setUpModule():
class TestHHblitsBindings(unittest.TestCase): class TestHHblitsBindings(unittest.TestCase):
def setUp(self): def setUp(self):
self.hhroot = os.getenv('EBROOTHHMINSUITE') # expects default hhblits installation...
hhblits_bin_dir = os.path.dirname(settings.Locate('hhblits'))
self.hhroot = os.path.join(hhblits_bin_dir, os.pardir)
def tearDown(self): def tearDown(self):
if hasattr(self, 'hh'): if hasattr(self, 'hh'):
...@@ -228,6 +231,7 @@ class TestHHblitsBindings(unittest.TestCase): ...@@ -228,6 +231,7 @@ class TestHHblitsBindings(unittest.TestCase):
'LSHCLLVTLAAHLPAEFTPAVHASLDKFLASVSTVL'+ 'LSHCLLVTLAAHLPAEFTPAVHASLDKFLASVSTVL'+
'TSKYR') 'TSKYR')
self.hh = hhblits.HHblits(query_seq, self.hhroot) self.hh = hhblits.HHblits(query_seq, self.hhroot)
csfile = self.hh.A3MToCS("testfiles/testali.a3m", csfile = self.hh.A3MToCS("testfiles/testali.a3m",
options={'-alphabet' : options={'-alphabet' :
os.path.join(self.hhroot, os.path.join(self.hhroot,
...@@ -417,10 +421,19 @@ class TestHHblitsBindings(unittest.TestCase): ...@@ -417,10 +421,19 @@ class TestHHblitsBindings(unittest.TestCase):
'a4b2554d... ATPEQAQLVHKEIRKIVKDTC\n') 'a4b2554d... ATPEQAQLVHKEIRKIVKDTC\n')
if __name__ == "__main__": if __name__ == "__main__":
hhsuite_root_dir = os.getenv('EBROOTHHMINSUITE') try:
if not hhsuite_root_dir: hhblits_version_string = hhblits.GetHHblitsVersionString()
print("No environment variable 'EBROOTHHMINSUITE'. To enable the "+\ except:
"unit test, this needs to point to your HHsuite installation.") print("No HHblits installation found: skip unit tests")
sys.exit(0)
if hhblits_version_string is None:
print("Could not identify HHblits version: skip unit tests")
sys.exit(0) sys.exit(0)
hhblits_version_major = int(hhblits_version_string.split('.')[0])
if hhblits_version_major != 3:
print("Found hhblits with major version %i. Unit tests only run with "\
"version 3: skip unit tests"%(hhblits_version_major))
sys.exit(0)
from ost import testutils from ost import testutils
testutils.RunTests() testutils.RunTests()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment