def testExtract(self): """ 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)
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)
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))
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))