Ejemplo n.º 1
0
    def testExtract(self):
        """
		This method tests :meth:`foundations.pkzip.Pkzip.extract` method.
		"""

        zipFile = Pkzip(TEST_FILE)
        tempDirectory = tempfile.mkdtemp()
        extractionSuccess = zipFile.extract(tempDirectory)
        self.assertTrue(extractionSuccess)
        for item in TREE_HIERARCHY:
            self.assertTrue(os.path.exists(os.path.join(tempDirectory, item)))
        shutil.rmtree(tempDirectory)
Ejemplo n.º 2
0
    def extractZipFile(self, file):
        """
		This method uncompress the given zip file.

		:param file: File to extract. ( String )
		:return: Extraction success. ( Boolean )
		"""

        LOGGER.debug("> Initializing '{0}' file uncompress.".format(file))

        pkzip = Pkzip()
        pkzip.archive = file

        return pkzip.extract(os.path.dirname(file))
Ejemplo n.º 3
0
    def extractZipFile(self, file):
        """
		Uncompress the given zip file.

		:param file: File to extract.
		:type file: unicode
		:return: Extraction success.
		:rtype: bool
		"""

        LOGGER.debug("> Initializing '{0}' file uncompress.".format(file))

        pkzip = Pkzip()
        pkzip.archive = file

        return pkzip.extract(os.path.dirname(file))