Skip to content

Commit b176aae

Browse files
committed
Use correct 7z test expectations on macOS
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent a45f156 commit b176aae

File tree

1 file changed

+33
-36
lines changed

1 file changed

+33
-36
lines changed

tests/extractcode/test_archive.py

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,19 +1821,13 @@ def test_extract_7z_with_trailing_data(self):
18211821
def test_extract_7z_with_broken_archive_with7z(self):
18221822
test_file = self.get_test_loc('archive/7z/corrupted7z.7z')
18231823
test_dir = self.get_temp_dir()
1824-
if on_mac:
1825-
msg = 'Incorrect 7zip listing with multiple headers'
1826-
else:
1827-
msg = 'There are data after the end of archive'
1824+
msg = 'There are data after the end of archive'
18281825
self.assertExceptionContains(msg, sevenzip.extract, test_file, test_dir)
18291826

18301827
def test_extract_7z_with_broken_archive_does_not_fail_when_using_fallback(self):
18311828
test_file = self.get_test_loc('archive/7z/corrupted7z.7z')
18321829
test_dir = self.get_temp_dir()
1833-
if on_mac:
1834-
msg = 'Incorrect 7zip listing with multiple headers'
1835-
else:
1836-
msg = 'There are data after the end of archive'
1830+
msg = 'There are data after the end of archive'
18371831
self.assertExceptionContains(msg, archive.extract_7z, test_file, test_dir)
18381832

18391833
def test_extract_7z_with_non_existing_archive(self):
@@ -2450,34 +2444,33 @@ class TestExtractArchiveWithIllegalFilenamesWithSevenzipOnMac(ExtractArchiveWith
24502444
def test_extract_7zip_with_weird_filenames_with_sevenzip_macos(self):
24512445
test_file = self.get_test_loc('archive/weird_names/weird_names.7z')
24522446
expected_exception = {
2453-
"weird_names/some 'file": 'Empty archive or incorrect arguments',
2454-
'weird_names/some file': 'Empty archive or incorrect arguments',
2455-
'weird_names/some \\file': 'Empty archive or incorrect arguments',
2456-
'weird_names/some"file': 'Empty archive or incorrect arguments',
2457-
'weird_names/some\\"file': 'Empty archive or incorrect arguments',
2458-
'weird_names/man\\1/..1.gz': 'Empty archive or incorrect arguments',
2459-
'weird_names/man\\1/[.1.gz': 'Empty archive or incorrect arguments',
2460-
'weird_names/man\\1/\\:.1.gz': 'Empty archive or incorrect arguments',
2461-
'weird_names/man\\1/:\\.1': 'Empty archive or incorrect arguments',
2462-
'weird_names/man\\1/[\\:*.1': 'Empty archive or incorrect arguments',
2463-
'weird_names/winchr/ab\t.t': 'Empty archive or incorrect arguments',
2464-
'weird_names/winchr/ab\n.t': 'Empty archive or incorrect arguments',
2465-
'weird_names/winchr/ab".t"': 'Empty archive or incorrect arguments',
2466-
'weird_names/winchr/ab*.t*': 'Empty archive or incorrect arguments',
2467-
'weird_names/winchr/ab<.t<': 'Empty archive or incorrect arguments',
2468-
'weird_names/winchr/ab>.t>': 'Empty archive or incorrect arguments',
2469-
'weird_names/winchr/ab?.t?': 'Empty archive or incorrect arguments',
2470-
'weird_names/winchr/ab\\.t\\': 'Empty archive or incorrect arguments',
2471-
'weird_names/winchr/ab|.t|': 'Empty archive or incorrect arguments',
2472-
'weird_names/man\\1': 'Empty archive or incorrect arguments'
2447+
'weird_names/man\\1/..1.gz': u'Empty archive or incorrect arguments',
2448+
'weird_names/man\\1/:\\.1': u'Empty archive or incorrect arguments',
2449+
'weird_names/man\\1/[.1.gz': u'Empty archive or incorrect arguments',
2450+
'weird_names/man\\1/[\\:*.1': u'Empty archive or incorrect arguments',
2451+
'weird_names/man\\1/\\:.1.gz': u'Empty archive or incorrect arguments',
2452+
"weird_names/some 'file": u'Empty archive or incorrect arguments',
2453+
'weird_names/some \\file': u'Empty archive or incorrect arguments',
2454+
'weird_names/some file': u'Empty archive or incorrect arguments',
2455+
'weird_names/some"file': u'Empty archive or incorrect arguments',
2456+
'weird_names/some\\"file': u'Empty archive or incorrect arguments',
2457+
'weird_names/winchr/ab\t.t': u'Empty archive or incorrect arguments',
2458+
'weird_names/winchr/ab\n.t': u'Empty archive or incorrect arguments',
2459+
'weird_names/winchr/ab".t"': u'Empty archive or incorrect arguments',
2460+
'weird_names/winchr/ab*.t*': u'Empty archive or incorrect arguments',
2461+
'weird_names/winchr/ab<.t<': u'Empty archive or incorrect arguments',
2462+
'weird_names/winchr/ab>.t>': u'Empty archive or incorrect arguments',
2463+
'weird_names/winchr/ab?.t?': u'Empty archive or incorrect arguments',
2464+
'weird_names/winchr/ab\\.t\\': u'Empty archive or incorrect arguments',
2465+
'weird_names/winchr/ab|.t|': u'Empty archive or incorrect arguments',
24732466
}
24742467

24752468
self.check_extract_weird_names(
24762469
sevenzip.extract,
24772470
test_file,
24782471
expected_warnings=[],
24792472
expected_suffix='7zip',
2480-
expected_exception=expected_exception)
2473+
expected_exception=expected_exception, regen=False)
24812474

24822475
def test_extract_ar_with_weird_filenames_with_sevenzip_macos(self):
24832476
test_file = self.get_test_loc('archive/weird_names/weird_names.ar')
@@ -2502,7 +2495,7 @@ def test_extract_ar_with_weird_filenames_with_sevenzip_macos(self):
25022495
test_file,
25032496
expected_warnings=[],
25042497
expected_suffix='7zip',
2505-
expected_exception=expected_exception)
2498+
expected_exception=expected_exception, regen=False)
25062499

25072500
def test_extract_cpio_with_weird_filenames_with_sevenzip_macos(self):
25082501
test_file = self.get_test_loc('archive/weird_names/weird_names.cpio')
@@ -2533,19 +2526,23 @@ def test_extract_cpio_with_weird_filenames_with_sevenzip_macos(self):
25332526
test_file,
25342527
expected_warnings=[],
25352528
expected_suffix='7zip',
2536-
expected_exception=expected_exception)
2529+
expected_exception=expected_exception, regen=False)
25372530

25382531
@pytest.mark.xfail
25392532
def test_extract_rar_with_weird_filenames_with_sevenzip_macos(self):
25402533
test_file = self.get_test_loc('archive/weird_names/weird_names.rar')
25412534
self.check_extract_weird_names(
2542-
sevenzip.extract, test_file, expected_warnings=[], expected_suffix='7zip')
2535+
sevenzip.extract,
2536+
test_file,
2537+
expected_warnings=[],
2538+
expected_suffix='7zip',
2539+
regen=False)
25432540

25442541
def test_extract_iso_with_weird_filenames_with_sevenzip_macos(self):
25452542
test_file = self.get_test_loc('archive/weird_names/weird_names.iso')
25462543
expected_exception = {
25472544
'weird_names/man_1/[.1.gz': 'Empty archive or incorrect arguments',
2548-
'weird_names/man_1/[___.1': 'Empty archive or incorrect arguments',
2545+
'weird_names/man_1/[___.1': 'Empty archive or incorrect arguments',
25492546
"weird_names/some 'file": 'Empty archive or incorrect arguments',
25502547
'weird_names/some _file': 'Empty archive or incorrect arguments',
25512548
'weird_names/some file': 'Empty archive or incorrect arguments',
@@ -2562,7 +2559,7 @@ def test_extract_iso_with_weird_filenames_with_sevenzip_macos(self):
25622559
test_file,
25632560
expected_warnings=[],
25642561
expected_suffix='7zip',
2565-
expected_exception=expected_exception)
2562+
expected_exception=expected_exception, regen=False)
25662563

25672564
def test_extract_tar_with_weird_filenames_with_sevenzip_macos(self):
25682565
test_file = self.get_test_loc('archive/weird_names/weird_names.tar')
@@ -2593,7 +2590,7 @@ def test_extract_tar_with_weird_filenames_with_sevenzip_macos(self):
25932590
test_file,
25942591
expected_warnings=[],
25952592
expected_suffix='7zip',
2596-
expected_exception=expected_exception)
2593+
expected_exception=expected_exception, regen=False)
25972594

25982595
def test_extract_zip_with_weird_filenames_with_sevenzip_macos(self):
25992596
test_file = self.get_test_loc('archive/weird_names/weird_names.zip')
@@ -2624,7 +2621,7 @@ def test_extract_zip_with_weird_filenames_with_sevenzip_macos(self):
26242621
test_file,
26252622
expected_warnings=[],
26262623
expected_suffix='7zip',
2627-
expected_exception=expected_exception)
2624+
expected_exception=expected_exception, regen=False)
26282625

26292626

26302627
@pytest.mark.skipif(not on_windows, reason='Run only on Windows because of specific test expectations.')

0 commit comments

Comments
 (0)