Skip to content

Commit d0aa2c1

Browse files
committed
rename the unicode lambda file to "lambda" and rename it at runtime when running the test.
distutils can't handle unicode filenames at install time.
1 parent 6e3322e commit d0aa2c1

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

test/test.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
# for output which reports a local time
33
os.environ['TZ'] = 'GMT'
4-
4+
import shutil
55
import os.path
66
import unittest
77

@@ -26,15 +26,20 @@ def assert_values(self, m, expected_values):
2626
self.assertEqual(value, expected_value_bytes)
2727

2828
def test_mime_types(self):
29-
m = magic.Magic(mime=True)
30-
self.assert_values(m, {
31-
'magic.pyc': 'application/octet-stream',
32-
'test.pdf': 'application/pdf',
33-
'test.gz': 'application/gzip',
34-
'text.txt': 'text/plain',
35-
b'\xce\xbb'.decode('utf-8'): 'text/plain',
36-
b'\xce\xbb': 'text/plain',
37-
})
29+
dest = os.path.join(MagicTest.TESTDATA_DIR, b'\xce\xbb'.decode('utf-8'))
30+
shutil.copyfile(os.path.join(MagicTest.TESTDATA_DIR, 'lambda'), dest)
31+
try:
32+
m = magic.Magic(mime=True)
33+
self.assert_values(m, {
34+
'magic.pyc': 'application/octet-stream',
35+
'test.pdf': 'application/pdf',
36+
'test.gz': 'application/gzip',
37+
'text.txt': 'text/plain',
38+
b'\xce\xbb'.decode('utf-8'): 'text/plain',
39+
b'\xce\xbb': 'text/plain',
40+
})
41+
finally:
42+
os.unlink(dest)
3843

3944
def test_descriptions(self):
4045
m = magic.Magic()
File renamed without changes.

0 commit comments

Comments
 (0)