From d0aa2c139c84320129706c468445ff2d2cb23506 Mon Sep 17 00:00:00 2001 From: Adam Hupp Date: Tue, 8 Dec 2015 22:07:37 -0800 Subject: 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. --- test/test.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'test/test.py') diff --git a/test/test.py b/test/test.py index b74a25f..2561383 100755 --- a/test/test.py +++ b/test/test.py @@ -1,7 +1,7 @@ import os # for output which reports a local time os.environ['TZ'] = 'GMT' - +import shutil import os.path import unittest @@ -26,15 +26,20 @@ class MagicTest(unittest.TestCase): self.assertEqual(value, expected_value_bytes) def test_mime_types(self): - m = magic.Magic(mime=True) - self.assert_values(m, { - 'magic.pyc': 'application/octet-stream', - 'test.pdf': 'application/pdf', - 'test.gz': 'application/gzip', - 'text.txt': 'text/plain', - b'\xce\xbb'.decode('utf-8'): 'text/plain', - b'\xce\xbb': 'text/plain', - }) + dest = os.path.join(MagicTest.TESTDATA_DIR, b'\xce\xbb'.decode('utf-8')) + shutil.copyfile(os.path.join(MagicTest.TESTDATA_DIR, 'lambda'), dest) + try: + m = magic.Magic(mime=True) + self.assert_values(m, { + 'magic.pyc': 'application/octet-stream', + 'test.pdf': 'application/pdf', + 'test.gz': 'application/gzip', + 'text.txt': 'text/plain', + b'\xce\xbb'.decode('utf-8'): 'text/plain', + b'\xce\xbb': 'text/plain', + }) + finally: + os.unlink(dest) def test_descriptions(self): m = magic.Magic() -- cgit v1.2.1