Пример #1
0
 def test_unpackBzip(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(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 Bzip file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True,
                          "Bzip file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True,
                          "Bzip file was not a tar file after fetching.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True, "Bzip file failed to unpack.")
         self.assertEqual(os.path.isdir(pci.currentPath), True,
                          "Bzip 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)
Пример #2
0
 def test_targetPathToName01(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         path = os.path.join(tempDir, "apr-1.4.5.tar.bz2")
         shutil.move(tarPath, path)
         name = target.targetPathToName(path)
         self.assertEquals(name, "apr", "Wrong name returned")
     finally:
         utilityFunctions.removeDir(tempDir)
Пример #3
0
 def test_targetPathToName01(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         path = os.path.join(tempDir, "apr-1.4.5.tar.bz2")
         shutil.move(tarPath, path)
         name = target.targetPathToName(path)
         self.assertEquals(name, "apr", "Wrong name returned")
     finally:
         utilityFunctions.removeDir(tempDir)
Пример #4
0
 def test_fetchBzip(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(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 Bzip file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Bzip file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Bzip file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Пример #5
0
    def test_isHgRepoCase3(self):
        #Case 3: Check for false positive with .bz2 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.createBzipFile(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.bz2"
        self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.")
Пример #6
0
    def test_isGitRepoCase3(self):
        #Case 3: Check for false positive with .bz2 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.createBzipFile(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.bz2"
        self.assertFalse(
            git.isGitRepo(path),
            "git.isGitRepo(" + path + ") should have returned false.")