diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index 8a3773b0aca0322ac5782f414fd73ba68fa93658..cfa10798c248f5d58385fcee070088ea138f0566 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -1,4 +1,5 @@ import unittest +import subprocess import ost from ost import * @@ -249,6 +250,19 @@ class TestMMCifInfo(unittest.TestCase): self.assertEqual(i.GetObsoleteInfo().GetPDBID(), '1FOO') self.assertEqual(i.GetObsoleteInfo().GetReplacedPDBID(), '2BAR') + def test_remote_loading(self): + + if subprocess.call(['ping google.com -c 1'], shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: + print("No internet connection (or wrong OS) to test remote loading in " + "io.LoadMMCIF: ignoring unit test") + return + + # let's hope that crambin stays the same forever + crambin_pdb = io.LoadMMCIF('1crn', remote=True) + self.assertEqual(len(crambin_pdb.residues), 46) + self.assertEqual(len(crambin_pdb.atoms), 327) + if __name__== '__main__': from ost import testutils testutils.RunTests() diff --git a/modules/io/tests/test_io_pdb.py b/modules/io/tests/test_io_pdb.py index 3ba3539dc337055e4d1237e1004d3474e38f281e..77a504fd8ff650f4ef26ca3a3477b38328c9f7aa 100644 --- a/modules/io/tests/test_io_pdb.py +++ b/modules/io/tests/test_io_pdb.py @@ -1,5 +1,6 @@ import unittest from ost import * +import subprocess class TestPDB(unittest.TestCase): def setUp(self): @@ -34,6 +35,22 @@ class TestPDB(unittest.TestCase): self.assertFalse(mol.BondExists(res1.FindAtom("CA"),res1.FindAtom("CB"))) self.assertTrue(mol.BondExists(res2.FindAtom("CA"),res2.FindAtom("CB"))) self.assertTrue(mol.BondExists(resd.FindAtom("CA"),resd.FindAtom("CB"))) + + def test_remote_loading(self): + + if subprocess.call(['ping google.com -c 1'], shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: + print("No internet connection (or wrong OS) to test remote loading in " + "io.LoadPDB: ignoring unit test") + return + + with self.assertRaises(IOError): + io.LoadPDB('1ake', remote=True, remote_repo="cheeseisgoodforyou") + + # let's hope that crambin stays the same forever + crambin_pdb = io.LoadPDB('1crn', remote=True, remote_repo='pdb') + self.assertEqual(len(crambin_pdb.residues), 46) + self.assertEqual(len(crambin_pdb.atoms), 327) if __name__== '__main__': from ost import testutils