diff options
author | Adam Hupp <adam@hupp.org> | 2018-01-14 22:27:32 -0800 |
---|---|---|
committer | Adam Hupp <adam@hupp.org> | 2018-01-14 22:27:32 -0800 |
commit | ac6143c4a16b3172ce38a2766861a166288ff8ad (patch) | |
tree | 64596967b9148663128ebec544b87c0f8509ca18 | |
parent | 798aa067dec6298edf4855eb899324e1aab20ca1 (diff) | |
download | python-magic-ac6143c4a16b3172ce38a2766861a166288ff8ad.tar.gz |
fix libmagic test
-rw-r--r-- | test/libmagic_test.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/libmagic_test.py b/test/libmagic_test.py index 5a0a290..8101c61 100644 --- a/test/libmagic_test.py +++ b/test/libmagic_test.py @@ -27,7 +27,11 @@ class MagicTestCase(unittest.TestCase): self.assert_result(result) def test_detect_from_content(self): - with open(self.filename) as fobj: + # differ from upstream by opening file in binary mode, + # this avoids hitting a bug in python3+libfile bindings + # see https://github.com/ahupp/python-magic/issues/152 + # for a similar issue + with open(self.filename, 'rb') as fobj: result = magic.detect_from_content(fobj.read(4096)) self.assert_result(result) |