Skip to content

Commit 7e76072

Browse files
committed
correctly find path to testdata when running from root
1 parent 6b34bde commit 7e76072

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/libmagic_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
import unittest
44
import os
55
import magic
6+
import os.path
67

78
# magic_descriptor is broken (?) in centos 7, so don't run those tests
89
SKIP_FROM_DESCRIPTOR = bool(os.environ.get('SKIP_FROM_DESCRIPTOR'))
910

11+
TESTDATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 'testdata'))
12+
13+
1014
class MagicTestCase(unittest.TestCase):
11-
filename = 'testdata/test.pdf'
15+
filename = os.path.join(TESTDATA_DIR, 'test.pdf')
1216
expected_mime_type = 'application/pdf'
1317
expected_encoding = 'us-ascii'
1418
expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')

0 commit comments

Comments
 (0)