python3Packages.python-magic: fix parquet tests for file 5.47

Edits the test to accept outputs from file 5.47 in addition to older
versions.

(cherry picked from commit 42aab0171bd46512ac3bb651b139827cc7e771c6)
This commit is contained in:
Adam Thompson-Sharpe
2026-05-06 12:10:44 -04:00
committed by Michael Daniels
parent 501aab04c3
commit 29355bc4e7
2 changed files with 23 additions and 0 deletions
@@ -38,6 +38,9 @@ buildPythonPackage rec {
url = "https://github.com/ahupp/python-magic/commit/3d2405ca80cd39b2a91decd26af81dcf181390a4.patch";
hash = "sha256-HRsnO9MGfMD9BkJdC4SrEFQ1OZEaXpwakXFLoaCPK94=";
})
# Fix test failures due to modified output in file 5.47
./fix-parquet-test.patch
];
preCheck = ''
@@ -0,0 +1,20 @@
--- a/test/python_magic_test.py
+++ b/test/python_magic_test.py
@@ -93,7 +93,7 @@ class MagicTest(unittest.TestCase):
'magic._pyc_': ('application/octet-stream', 'text/x-bytecode.python', 'application/x-bytecode.python'),
'test.pdf': 'application/pdf',
'test.gz': ('application/gzip', 'application/x-gzip'),
- 'test.snappy.parquet': 'application/octet-stream',
+ 'test.snappy.parquet': ('application/octet-stream', 'application/vnd.apache.parquet'),
'text.txt': 'text/plain',
b'\xce\xbb'.decode('utf-8'): 'text/plain',
b'\xce\xbb': 'text/plain',
@@ -123,7 +123,7 @@ class MagicTest(unittest.TestCase):
': Sun Jun 29 01:32:52 2008, from Unix, truncated'
),
'text.txt': 'ASCII text',
- 'test.snappy.parquet': ('Apache Parquet', 'Par archive data'),
+ 'test.snappy.parquet': ('Apache Parquet', 'Apache Parquet file', 'Par archive data'),
}, buf_equals_file=False)
finally:
del os.environ['TZ']