Skip to content
Snippets Groups Projects
Commit 9c0ce92f authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Update tests to support zipdetails "4.004" shipped with Perl 5.40. (Closes:...

Update tests to support zipdetails "4.004" shipped with Perl 5.40. (Closes: #377)
parent 0b72d393
No related branches found
No related tags found
No related merge requests found
Pipeline #685803 passed with warnings
......@@ -24,7 +24,9 @@ from diffoscope.comparators.zip import ZipFile
from diffoscope.comparators.missing_file import MissingFile
from ..utils.data import load_fixture, get_data
from ..utils.tools import skip_unless_tools_exist
from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from .test_zip import zipdetails_version
epub1 = load_fixture("test1.epub")
......@@ -46,6 +48,7 @@ def differences(epub1, epub2):
@skip_unless_tools_exist("zipinfo", "zipdetails")
@skip_unless_tool_is_at_least("zipdetails", zipdetails_version, "4.004")
def test_differences(differences):
assert differences[0].source1 == "zipinfo {}"
assert differences[0].source2 == "zipinfo {}"
......
......@@ -18,11 +18,12 @@
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import pytest
import subprocess
from diffoscope.comparators.zip import ZipFile, MozillaZipFile, JmodJavaModule
from ..utils.data import load_fixture, assert_diff
from ..utils.tools import skip_unless_tools_exist
from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from ..utils.nonexisting import assert_non_existing
......@@ -39,6 +40,10 @@ test_comment1 = load_fixture("test_comment1.zip")
test_comment2 = load_fixture("test_comment2.zip")
def zipdetails_version():
return subprocess.check_output(["zipdetails", "--version"]).decode("UTF-8")
def test_identification(zip1):
assert isinstance(zip1, ZipFile)
......@@ -59,6 +64,7 @@ def differences2(zip1, zip3):
@skip_unless_tools_exist("zipinfo", "zipdetails")
@skip_unless_tool_is_at_least("zipdetails", zipdetails_version, "4.004")
def test_metadata(differences):
assert_diff(differences[0], "zip_zipinfo_expected_diff")
assert_diff(differences[1], "zip_zipdetails_expected_diff")
......@@ -144,6 +150,7 @@ def comment_differences(test_comment1, test_comment2):
@skip_unless_tools_exist("zipnote", "zipdetails")
@skip_unless_tool_is_at_least("zipdetails", zipdetails_version, "4.004")
def test_commented(comment_differences):
assert_diff(comment_differences[1], "comment_zipinfo_expected_diff")
assert_diff(comment_differences[2], "comment_zipdetails_expected_diff")
@@ -33,15 +33,15 @@
004B Compression Method 0000 'Stored'
004D Last Mod Time 4D869485 'Thu Dec 6 18:36:10 2018'
0051 CRC 00000000
0055 Compressed Length 00000000
0059 Uncompressed Length 00000000
005D Filename Length 0003
005F Extra Length 0018
-0061 Comment Length 0000
+0061 Comment Length 0005
0063 Disk Start 0000
0065 Int File Attributes 0000
@@ -37,15 +37,15 @@
0047 Compression Method 0000 (0) 'Stored'
0049 Modification Time 4D869485 (1300665477) 'Thu Dec 6 18:36:10 2018'
004D CRC 00000000 (0)
0051 Compressed Size 00000000 (0)
0055 Uncompressed Size 00000000 (0)
0059 Filename Length 0003 (3)
005B Extra Length 0018 (24)
-005D Comment Length 0000 (0)
+005D Comment Length 0005 (5)
005F Disk Start 0000 (0)
0061 Int File Attributes 0000 (0)
[Bit 0] 0 'Binary Data'
0067 Ext File Attributes 81A40000
006B Local Header Offset 00000000
006F Filename 'XXX'
0072 Extra ID #0001 5455 'UT: Extended Timestamp'
@@ -51,17 +51,19 @@
007B Extra ID #0002 7875 'ux: Unix Extra Type 3'
007D Length 000B
007F Version 01
0080 UID Size 04
0081 UID 000003E8
0085 GID Size 04
0086 GID 000003E8
+008A Comment 'hello'
0063 Ext File Attributes 81A40000 (2175008768)
[Bits 16-24] 01A4 (420) 'Unix attrib: rw-r--r--'
[Bits 28-31] 08 (8) 'Regular File'
0067 Local Header Offset 00000000 (0)
@@ -61,20 +61,22 @@
0077 Extra ID #2 7875 (30837) 'Unix Extra type 3 [ux]'
0079 Length 000B (11)
007B Version 01 (1)
007C UID Size 04 (4)
007D UID 000003E8 (1000)
0081 GID Size 04 (4)
0082 GID 000003E8 (1000)
+0086 Comment 'XXXXX'
-0086 END CENTRAL HEADER 06054B50
-008A Number of this disk 0000
-008C Central Dir Disk no 0000
-008E Entries in this disk 0001
-0090 Total Entries 0001
-0092 Size of Central Dir 00000049
-0096 Offset to Central Dir 0000003D
-009A Comment Length 0000
+008B END CENTRAL HEADER 06054B50
+008F Number of this disk 0000
+0091 Central Dir Disk no 0000
+0093 Entries in this disk 0001
+0095 Total Entries 0001
+0097 Size of Central Dir 0000004E
+009B Offset to Central Dir 0000003D
+009F Comment Length 0007
+00A1 Comment 'goodbye'
Done
-0086 END CENTRAL HEADER 06054B50 (101010256)
-008A Number of this disk 0000 (0)
-008C Central Dir Disk no 0000 (0)
-008E Entries in this disk 0001 (1)
-0090 Total Entries 0001 (1)
-0092 Size of Central Dir 00000049 (73)
-0096 Offset to Central Dir 0000003D (61)
-009A Comment Length 0000 (0)
+008B END CENTRAL HEADER 06054B50 (101010256)
+008F Number of this disk 0000 (0)
+0091 Central Dir Disk no 0000 (0)
+0093 Entries in this disk 0001 (1)
+0095 Total Entries 0001 (1)
+0097 Size of Central Dir 0000004E (78)
+009B Offset to Central Dir 0000003D (61)
+009F Comment Length 0007 (7)
+00A1 Comment 'XXXXXXX'
#
# Warning Count: 2
#
# Done
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment