def test_make_zip(self): """ Test makeZip """ here = os.path.dirname(__file__) files = [os.path.join(here, f) for f in os.listdir(here) if f[-3:] == ".py"] zip_path = os.path.join(here, '_test.zip') self.assertTrue(helpers.makeZip(files, zip_path)) self.assertFalse(helpers.makeZip(files, '/:/_test.zip')) if os.path.isfile(zip_path): os.remove(zip_path)
def test_extract_zip(self): """ Test extractZip """ here = os.path.dirname(__file__) files = [os.path.join(here, f) for f in os.listdir(here) if f[-3:] == ".py"] zip_path = os.path.join(here, '_test.zip') helpers.makeZip(files, zip_path) extract_path = os.path.join(here, '_extract_test') self.assertTrue(helpers.extractZip(zip_path, extract_path)) self.assertFalse(helpers.extractZip(zip_path, '/:/_extract')) # Test skip directories: files += [os.path.join(here, 'Logs')] helpers.makeZip(files, zip_path) self.assertTrue(helpers.extractZip(zip_path, extract_path)) if os.path.isfile(zip_path): os.remove(zip_path) if os.path.isdir(extract_path): rmtree(extract_path)