summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2018-01-14 22:27:32 -0800
committerAdam Hupp <adam@hupp.org>2018-01-14 22:27:32 -0800
commit315cb4ceb556251bc6ee7d0cd1b9da11ab3285f9 (patch)
tree4660e3d3ee473e380453bdd89ad850b8497288c3
parent43d057d27396891cc51327cc24580a0dec211408 (diff)
downloadpython-magic-libmagic-compat.tar.gz
fix libmagic testlibmagic-compat
-rw-r--r--test/libmagic_test.py6
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)