19
19
# limitations under the License.
20
20
#
21
21
22
- import io
23
22
import os
24
23
25
24
import pytest
26
25
27
- import commoncode . date
26
+ from commoncode import date as commoncode_date
28
27
from commoncode import fileutils
29
28
from commoncode .system import on_linux
30
29
from commoncode .system import on_mac
31
30
from commoncode .system import on_windows
31
+ from commoncode .testcase import is_same
32
32
33
33
from extractcode_assert_utils import BaseArchiveTestCase
34
34
from extractcode_assert_utils import check_files
40
40
from extractcode import ExtractErrorFailedToExtract
41
41
from extractcode import libarchive2
42
42
from extractcode import sevenzip
43
- from extractcode .libarchive2 import ArchiveError
44
43
45
44
"""
46
45
For each archive type --when possible-- we are testing extraction of:
@@ -383,7 +382,7 @@ def test_extract_targz_with_trailing_data2(self):
383
382
test_dir2 = self .get_temp_dir ()
384
383
test_file2 = self .get_test_loc ('archive/tgz/no_trailing.tar.gz' )
385
384
archive .extract_tar (test_file2 , test_dir2 )
386
- assert commoncode . testcase . is_same (test_dir1 , test_dir2 )
385
+ assert is_same (test_dir1 , test_dir2 )
387
386
388
387
def test_extract_targz_with_mixed_case_and_symlink (self ):
389
388
test_file = self .get_test_loc ('archive/tgz/mixed_case_and_symlink.tgz' )
@@ -960,7 +959,7 @@ def test_extract_zip_with_timezone(self):
960
959
]
961
960
# DST sends a monkey wrench.... so we only test the date, not the time
962
961
for loc , expected_date in expected :
963
- result = commoncode . date .get_file_mtime (loc )
962
+ result = commoncode_date .get_file_mtime (loc )
964
963
assert result .startswith (expected_date )
965
964
966
965
def test_extract_zip_with_timezone_2 (self ):
@@ -974,7 +973,7 @@ def test_extract_zip_with_timezone_2(self):
974
973
(os .path .join (test_dir , 'primes2.txt' ), ('2009-12-05' , '2009-12-06' ,))
975
974
]
976
975
for loc , expected_date in expected :
977
- result = commoncode . date .get_file_mtime (loc )
976
+ result = commoncode_date .get_file_mtime (loc )
978
977
assert result .startswith (expected_date )
979
978
980
979
def test_extract_zip_with_backslash_in_path_1 (self ):
@@ -1268,7 +1267,7 @@ def test_extract_ar_verify_dates(self):
1268
1267
]
1269
1268
# DST sends a monkey wrench.... so we only test the date, not the time
1270
1269
for loc , expected_date in expected :
1271
- result = commoncode . date .get_file_mtime (loc )
1270
+ result = commoncode_date .get_file_mtime (loc )
1272
1271
assert result .startswith (expected_date )
1273
1272
1274
1273
def test_extract_ar_broken_7z (self ):
@@ -2318,7 +2317,7 @@ def test_extract_ar_with_weird_filenames_with_libarchive_win(self):
2318
2317
self .check_extract_weird_names (
2319
2318
libarchive2 .extract , test_file , expected_warnings = [], expected_suffix = 'libarch' )
2320
2319
self .fail ('Exception not raised.' )
2321
- except ArchiveError as ae :
2320
+ except libarchive2 . ArchiveError as ae :
2322
2321
assert str (ae ).startswith ('Incorrect file header signature' )
2323
2322
2324
2323
def test_extract_cpio_with_weird_filenames_with_libarchive_win (self ):
0 commit comments