def test_unpackGzip(self): try: tempDir = mdTestUtilities.makeTempDir() tarDir, tarName = mdTestUtilities.createGzipFile(tempDir) tarPath = os.path.join(tempDir, tarName) pci = createPythonCallInfo(tarPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Local Gzip file failed to fetch.") 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, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.") finally: utilityFunctions.removeDir(tempDir)
def test_fetchURL(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.") finally: utilityFunctions.removeDir(tempDir)
def test_fetchGzip(self): try: tempDir = mdTestUtilities.makeTempDir() tarDir, tarName = mdTestUtilities.createGzipFile(tempDir) tarPath = os.path.join(tempDir, tarName) pci = createPythonCallInfo(tarPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download")) pci = steps.fetch(pci) self.assertEqual(pci.success, True, "Local Gzip file failed to fetch.") 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.") finally: utilityFunctions.removeDir(tempDir)
def test_isHgRepoCase4(self): #Case 4: Check for false positive with .gz files if not hg.isHgInstalled(): self.fail("Hg is not installed on your system. All Hg tests will fail.") #Local file try: tempDir = mdTestUtilities.makeTempDir() tarDir, path = mdTestUtilities.createGzipFile(tempDir) self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.") finally: utilityFunctions.removeDir(tempDir) #Remote file path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz" self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.")
def test_isGitRepoCase4(self): #Case 4: Check for false positive with .gz files if not git.isGitInstalled(): self.fail( "Git is not installed on your system. All Git tests will fail." ) #Local file try: tempDir = mdTestUtilities.makeTempDir() tarDir, path = mdTestUtilities.createGzipFile(tempDir) self.assertFalse( git.isGitRepo(path), "git.isGitRepo(" + path + ") should have returned false.") finally: utilityFunctions.removeDir(tempDir) #Remote file path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz" self.assertFalse( git.isGitRepo(path), "git.isGitRepo(" + path + ") should have returned false.")