Browse Source

Adjust test suite for changes in file 5.39. Closes: #975784

Christoph Biedl 10 months ago
parent
commit
fc9e2c7576
3 changed files with 35 additions and 1 deletions
  1. 2 1
      debian/control
  2. 1 0
      debian/patches/series
  3. 32 0
      debian/patches/upstream.fix-mime-test.patch

+ 2 - 1
debian/control

@@ -7,6 +7,7 @@ Vcs-Git: https://git.in-ulm.de/cbiedl/python-magic.git
 Testsuite: autopkgtest-pkg-python
 Build-Depends: debhelper-compat (= 12),
     dh-python,
+    libmagic1 (>= 1:5.39),
     python3-all,
     python3-setuptools,
 Priority: extra
@@ -16,7 +17,7 @@ Section: libs
 Package: python3-magic
 Architecture: all
 Depends: ${misc:Depends}, ${python3:Depends},
-    libmagic1,
+    libmagic1 (>= 1:5.39),
 Section: python
 Priority: optional
 Description: python3 interface to the libmagic file type identification library

+ 1 - 0
debian/patches/series

@@ -4,6 +4,7 @@ libmagic-compat.patch
 cherry-pick.0.4.15-31-g063a667.fixing-warning-on-python-3-8.patch
 
 # patches that should go upstream
+upstream.fix-mime-test.patch
 
 # modifications for Debian
 disable-gzip-test.patch

+ 32 - 0
debian/patches/upstream.fix-mime-test.patch

@@ -0,0 +1,32 @@
+Subject: Adjust test suite for changes in file 5.39
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de> 
+Date: 2020-11-26
+Bug-Debian: https://bugs.debian.org/975784
+Forwarded: no
+
+    MIME-type for python was added/changed in FILE5_38-36-geb373e43
+    Detection of trunucated files was added in FILE5_38-106-g0c7cd78b
+
+--- a/test/test.py
++++ b/test/test.py
+@@ -34,9 +34,9 @@
+     def test_from_buffer_str_and_bytes(self):
+         m = magic.Magic(mime=True)
+         s = '#!/usr/bin/env python\nprint("foo")'
+-        self.assertEqual("text/x-python", m.from_buffer(s))
++        self.assertEqual("text/x-script.python", m.from_buffer(s))
+         b = b'#!/usr/bin/env python\nprint("foo")'
+-        self.assertEqual("text/x-python", m.from_buffer(b))
++        self.assertEqual("text/x-script.python", m.from_buffer(b))
+ 
+ 
+     def test_open_file(self):
+@@ -50,7 +50,7 @@
+         try:
+             m = magic.Magic(mime=True)
+             self.assert_values(m, {
+-                'magic._pyc_': 'application/octet-stream',
++                'magic._pyc_': 'text/x-bytecode.python',
+                 'test.pdf': 'application/pdf',
+                 'test.gz': 'application/gzip',
+                 'text.txt': 'text/plain',