From 1b7f6ea2a695e1ae9d5af774b71c93a9b8180967 Mon Sep 17 00:00:00 2001
From: Gerardo Tauriello <gerardo.tauriello@unibas.ch>
Date: Tue, 22 Aug 2017 16:02:22 +0200
Subject: [PATCH] SCHWED-2638: fixed/cleaned-up dssp-locate-check in unit tests

---
 modules/mol/alg/tests/test_accessibility.py | 17 ++++++-----------
 modules/mol/alg/tests/test_sec_struct.py    | 14 ++++++--------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/modules/mol/alg/tests/test_accessibility.py b/modules/mol/alg/tests/test_accessibility.py
index 3ff4c0fde..c3d857fd5 100644
--- a/modules/mol/alg/tests/test_accessibility.py
+++ b/modules/mol/alg/tests/test_accessibility.py
@@ -111,19 +111,14 @@ class TestAccessibility(unittest.TestCase):
 
   def testAccDSSP(self):
 
-    dssp_path = None
-
+    # only relevant if dssp there
     try:
-      dssp_path = settings.Locate("dssp")
+      # same check used in dssp binding
+      dssp_path = settings.Locate(['dsspcmbi', 'dssp', 'mkdssp'],
+                                  env_name='DSSP_EXECUTABLE')
     except:
-      try:
-        dssp_path = settings.locate("mkdssp")
-      except:
-        pass
-      pass
-
-    if dssp_path == None:
       print "Could not find DSSP, could not compare Accessibility function..."
+      return
 
     # we assume oligo mode to be working as it is tested in 
     # testAccNACCESS. So we only test the single residue
@@ -133,7 +128,7 @@ class TestAccessibility(unittest.TestCase):
     ent_one = ent_one.Select("peptide=true")
     ent_two = ent_two.Select("peptide=true")
 
-    dssp.AssignDSSP(ent_one, extract_burial_status=True, dssp_bin = dssp_path)
+    dssp.AssignDSSP(ent_one, extract_burial_status=True, dssp_bin=dssp_path)
     mol.alg.Accessibility(ent_two, algorithm=mol.alg.AccessibilityAlgorithm.DSSP)
 
     for a,b in zip(ent_one.residues, ent_two.residues):
diff --git a/modules/mol/alg/tests/test_sec_struct.py b/modules/mol/alg/tests/test_sec_struct.py
index 3c2d11295..207f8600c 100644
--- a/modules/mol/alg/tests/test_sec_struct.py
+++ b/modules/mol/alg/tests/test_sec_struct.py
@@ -9,20 +9,18 @@ class TestSecStruct(unittest.TestCase):
   def testSecStruct(self):
 
     # unit test only makes sense, when a dssp binary is around
-    dssp_path = None
     try:
-      dssp_path = settings.Locate("dssp")
+      # same check used in dssp binding
+      dssp_path = settings.Locate(['dsspcmbi', 'dssp', 'mkdssp'],
+                                  env_name='DSSP_EXECUTABLE')
     except:
-      try:
-        dssp_path = settings.Locate("mkdssp")
-      except:
-        print "Could not find dssp, could not compare sec struct assignment..."
-        return
+      print "Could not find DSSP, could not compare sec struct assignment..."
+      return
 
     dssp_ent = io.LoadPDB(os.path.join("testfiles", "1a0s.pdb"))
     ost_ent = io.LoadPDB(os.path.join("testfiles", "1a0s.pdb"))
 
-    dssp.AssignDSSP(dssp_ent, dssp_bin = dssp_path)
+    dssp.AssignDSSP(dssp_ent, dssp_bin=dssp_path)
     mol.alg.AssignSecStruct(ost_ent)
 
     for a, b in zip(dssp_ent.residues, ost_ent.residues):
-- 
GitLab