1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
''' Unit tests for the Naccess wrapper
'''
import unittest
import sys
import shutil
import tempfile
from ost.bindings import naccess
from ost import io, settings
class TestNaccessBindings(unittest.TestCase):
def testTempDirWithDot(self):
# naccess itself has problems with '.' in the path. So we need to test
# that it works when data is used which has a correpsonding path.
na_tmp_dir = tempfile.mkdtemp(prefix="ih.")
def cleanup():
shutil.rmtree(na_tmp_dir)
self.addCleanup(cleanup)
ost_ent = io.LoadPDB('testfiles/testprotein.pdb')
excp_raised = False
try:
sasa = naccess.CalculateSurfaceArea(ost_ent,
scratch_dir=na_tmp_dir)
except:
excp_raised = True
raise
self.assertEqual(excp_raised, False, msg="Naccess raised an "+
"exception on a path containing a '.'. This is not "+
"supposed to happen.")
if __name__ == "__main__":
try:
settings.Locate("naccess")
except:
print("Could not find NACCESS, could not test binding...")
sys.exit(0)
from ost import testutils
testutils.RunTests()
|