|
12 | 12 | from pathlib import Path
|
13 | 13 |
|
14 | 14 | import pytest
|
15 |
| - |
16 | 15 | from commoncode import date as commoncode_date
|
17 | 16 | from commoncode import fileutils
|
18 | 17 | from commoncode.system import on_linux
|
19 | 18 | from commoncode.system import on_mac
|
20 | 19 | from commoncode.system import on_windows
|
21 | 20 | from commoncode.testcase import is_same
|
22 |
| - |
23 | 21 | from extractcode_assert_utils import BaseArchiveTestCase
|
24 | 22 | from extractcode_assert_utils import check_files
|
25 | 23 | from extractcode_assert_utils import check_size
|
26 | 24 | from extractcode_assert_utils import to_posix
|
27 | 25 |
|
28 | 26 | import extractcode
|
29 |
| -from extractcode import archive |
30 | 27 | from extractcode import ExtractErrorFailedToExtract
|
| 28 | +from extractcode import archive |
31 | 29 | from extractcode import libarchive2
|
32 | 30 | from extractcode import sevenzip
|
33 | 31 |
|
@@ -291,9 +289,11 @@ def test_7zip_extract_can_extract_to_relative_paths(self):
|
291 | 289 | # The setup is a tad complex because we want to have a relative dir
|
292 | 290 | # to the base dir where we run tests from, i.e. the git checkout dir.
|
293 | 291 | # To use relative paths, we use our tmp dir at the root of the code tree
|
294 |
| - from os.path import join, abspath |
295 |
| - import tempfile |
296 | 292 | import shutil
|
| 293 | + import tempfile |
| 294 | + from os.path import abspath |
| 295 | + from os.path import join |
| 296 | + |
297 | 297 | from extractcode.sevenzip import extract
|
298 | 298 |
|
299 | 299 | test_file = self.get_test_loc('archive/relative_path/basic.zip', copy=True)
|
@@ -1649,9 +1649,11 @@ def test_extract_twice_can_extract_to_relative_paths(self):
|
1649 | 1649 | # The setup is a tad complex because we want to have a relative dir
|
1650 | 1650 | # to the base dir where we run tests from, i.e. the git checkout dir
|
1651 | 1651 | # To use relative paths, we use our tmp dir at the root of the code tree
|
1652 |
| - from os.path import join, abspath, exists |
1653 | 1652 | import shutil
|
1654 | 1653 | import tempfile
|
| 1654 | + from os.path import abspath |
| 1655 | + from os.path import exists |
| 1656 | + from os.path import join |
1655 | 1657 |
|
1656 | 1658 | test_file = self.get_test_loc('archive/rpm/xz-compressed-cpio.rpm')
|
1657 | 1659 | # this will return an extractor that extracts twice
|
@@ -1689,8 +1691,11 @@ def test_extract_rar_with_invalid_path(self):
|
1689 | 1691 | def test_extract_rar_with_trailing_data(self):
|
1690 | 1692 | test_file = self.get_test_loc('archive/rar/rar_trailing.rar')
|
1691 | 1693 | test_dir = self.get_temp_dir()
|
1692 |
| - expected = Exception('Unknown error') |
1693 |
| - self.assertRaisesInstance(expected, archive.extract_rar, test_file, test_dir) |
| 1694 | + if on_mac: |
| 1695 | + archive.extract_rar(test_file, test_dir) |
| 1696 | + else: |
| 1697 | + expected = Exception('Unknown error') |
| 1698 | + self.assertRaisesInstance(expected, archive.extract_rar, test_file, test_dir) |
1694 | 1699 | result = os.path.join(test_dir, 'd', 'b', 'a.txt')
|
1695 | 1700 | assert os.path.exists(result)
|
1696 | 1701 |
|
|
0 commit comments