summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2022-04-25 06:52:45 -0700
committerAdam Hupp <adam@hupp.org>2022-04-25 06:55:20 -0700
commit7e760728889b3d3928310a453ebe3383adb37984 (patch)
tree3c9e0660bafc7b6655b1a383451a16596c32db1f
parent6b34bde052be74334dad71963d92a1c49eecd168 (diff)
downloadpython-magic-7e760728889b3d3928310a453ebe3383adb37984.tar.gz
correctly find path to testdata when running from root
-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 88f1254..5719a58 100644
--- a/test/libmagic_test.py
+++ b/test/libmagic_test.py
@@ -3,12 +3,16 @@
import unittest
import os
import magic
+import os.path
# magic_descriptor is broken (?) in centos 7, so don't run those tests
SKIP_FROM_DESCRIPTOR = bool(os.environ.get('SKIP_FROM_DESCRIPTOR'))
+TESTDATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 'testdata'))
+
+
class MagicTestCase(unittest.TestCase):
- filename = 'testdata/test.pdf'
+ filename = os.path.join(TESTDATA_DIR, 'test.pdf')
expected_mime_type = 'application/pdf'
expected_encoding = 'us-ascii'
expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')