def test_unpackZip(self): try: tempDir = mdTestUtilities.makeTempDir() zipDir, zipName = mdTestUtilities.createZipFile(tempDir) zipPath = os.path.join(tempDir, zipName) pci = createPythonCallInfo(zipPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Local Zip file failed to fetch.") self.assertEqual(os.path.exists(pci.currentPath), True, "Zip file did not exist after fetching.") self.assertEqual(zipfile.is_zipfile(pci.currentPath), True, "Zip file was not a tar file after fetching.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Zip file failed to unpack.") self.assertEqual(os.path.isdir(pci.currentPath), True, "Zip file was not a directory after unpacking.") self.assertEqual( os.path.exists( os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_unpackSvn(self): if not svn.isSvnInstalled(): self.fail( "Svn is not installed on your system. All Svn tests will fail." ) try: tempDir = mdTestUtilities.makeTempDir() repoPath = mdTestUtilities.createSvnRepository(tempDir) pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName) self.assertEqual(pci.success, True, "Svn repository failed to fetch.") self.assertEqual( os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Svn repository.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Svn repository failed to unpack.") self.assertEqual( os.path.isdir(pci.currentPath), True, "Svn repository was not a directory after unpacking.") self.assertEqual( os.path.exists( os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_unpackURL(self): try: tempDir = mdTestUtilities.makeTempDir() tarDir, tarName = mdTestUtilities.createGzipFile(tempDir) urlPath = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz" pci = createPythonCallInfo(urlPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Gzip file failed to fetch from URL.") self.assertEqual(os.path.exists(pci.currentPath), True, "Gzip file did not exist after fetching.") self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Gzip file was not a tar file after fetching.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Gzip file failed to unpack.") self.assertEqual(os.path.isdir(pci.currentPath), True, "Gzip file was not a directory after unpacking.") self.assertEqual(os.path.exists(os.path.join(pci.currentPath, "configure.ac")), True, "configure.ac file did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_unpackZip(self): try: tempDir = mdTestUtilities.makeTempDir() zipDir, zipName = mdTestUtilities.createZipFile(tempDir) zipPath = os.path.join(tempDir, zipName) pci = createPythonCallInfo(zipPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Local Zip file failed to fetch.") self.assertEqual(os.path.exists(pci.currentPath), True, "Zip file did not exist after fetching.") self.assertEqual(zipfile.is_zipfile(pci.currentPath), True, "Zip file was not a tar file after fetching.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Zip file failed to unpack.") self.assertEqual(os.path.isdir(pci.currentPath), True, "Zip file was not a directory after unpacking.") self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_unpackSvn(self): if not svn.isSvnInstalled(): self.fail("Svn is not installed on your system. All Svn tests will fail.") try: tempDir = mdTestUtilities.makeTempDir() repoPath = mdTestUtilities.createSvnRepository(tempDir) pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName) self.assertEqual(pci.success, True, "Svn repository failed to fetch.") self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Svn repository.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Svn repository failed to unpack.") self.assertEqual(os.path.isdir(pci.currentPath), True, "Svn repository was not a directory after unpacking.") self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_unpackURL(self): try: tempDir = mdTestUtilities.makeTempDir() tarDir, tarName = mdTestUtilities.createGzipFile(tempDir) urlPath = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz" pci = createPythonCallInfo(urlPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Gzip file failed to fetch from URL.") self.assertEqual(os.path.exists(pci.currentPath), True, "Gzip file did not exist after fetching.") self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Gzip file was not a tar file after fetching.") pci = steps.unpack(pci) self.assertEqual(pci.success, True, "Gzip file failed to unpack.") self.assertEqual(os.path.isdir(pci.currentPath), True, "Gzip file was not a directory after unpacking.") self.assertEqual( os.path.exists(os.path.join(pci.currentPath, "configure.ac")), True, "configure.ac file did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)