diff options
author | Adam Hupp <adam@hupp.org> | 2015-12-08 22:07:37 -0800 |
---|---|---|
committer | Adam Hupp <adam@hupp.org> | 2016-03-20 18:55:09 -0700 |
commit | d0aa2c139c84320129706c468445ff2d2cb23506 (patch) | |
tree | 42886eeb15d73e3819be3560a4d267feeb8c1295 /test/test.py | |
parent | 6e3322e101795da8f143a5f506487431c8e5168a (diff) | |
download | python-magic-d0aa2c139c84320129706c468445ff2d2cb23506.tar.gz |
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.
Diffstat (limited to 'test/test.py')
-rwxr-xr-x | test/test.py | 25 |
1 files changed, 15 insertions, 10 deletions
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() |