How to use the extractcode.archive.extract_7z function in extractcode

To help you get started, we’ve selected a few extractcode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_cb7_basic_with_weird_filename_extension(self):
        test_file = self.get_test_loc('archive/cb7/t.cb7.foo')
        test_dir = self.get_temp_dir()
        archive.extract_7z(test_file, test_dir)
        extracted = self.collect_extracted_path(test_dir)
        expected = ['/t/', '/t/t.txt']
        assert expected == extracted
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7zip_with_fallback_with_unicode_path_should_extract_without_error(self):
        test_file = self.get_test_loc('archive/7z/7zip_unicode.7z')
        test_dir = self.get_temp_dir()
        result = archive.extract_7z(test_file, test_dir)
        assert [] == result
        assert 2 == len(os.listdir(os.path.join(test_dir, 'zip')))
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7z_basic_with_space_in_file_name(self):
        test_file = self.get_test_loc('archive/7z/t .7z')
        test_dir = self.get_temp_dir()
        result = archive.extract_7z(test_file, test_dir)
        assert [] == result
        expected = ['t/t.txt']
        check_files(test_dir, expected)
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7z_basic(self):
        test_file = self.get_test_loc('archive/7z/z.7z')
        test_dir = self.get_temp_dir()
        result = archive.extract_7z(test_file, test_dir)
        assert [] == result
        expected = ['z/a/a.txt', 'z/b/a.txt', 'z/c/a.txt']
        check_files(test_dir, expected)
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7z_with_invalid_path(self):
        test_file = self.get_test_loc('archive/7z/7zip_invalidpath.7z')
        test_dir = self.get_temp_dir()
        result = archive.extract_7z(test_file, test_dir)
        assert [] == result
        extracted = self.collect_extracted_path(test_dir)
        expected = ['/this/', '/this/that']
        assert expected == extracted
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_cb7_basic_with_space_in_file_name(self):
        test_file = self.get_test_loc('archive/cb7/t .cb7')
        test_dir = self.get_temp_dir()
        archive.extract_7z(test_file, test_dir)
        extracted = self.collect_extracted_path(test_dir)
        expected = ['/t/', '/t/t.txt']
        assert expected == extracted
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7zip_libarchive_with_unicode_path_extracts_with_errors(self):
        test_file = self.get_test_loc('archive/7z/7zip_unicode.7z')
        test_dir = self.get_temp_dir()
        try:
            archive.extract_7z(test_file, test_dir)
        except libarchive2.ArchiveError, e:
            assert 'Damaged 7-Zip archive' in e.msg
github nexB / scancode-toolkit / tests / extractcode / test_archive.py View on Github external
def test_extract_7z_with_trailing_data(self):
        test_file = self.get_test_loc('archive/7z/7zip_trailing.7z')
        test_dir = self.get_temp_dir()
        result = archive.extract_7z(test_file, test_dir)
        assert [] == result
        expected = ['z/a/a.txt', 'z/b/a.txt', 'z/c/a.txt']
        check_files(test_dir, expected)