Try to fix loading of JSON files in tests on Travis

This commit is contained in:
Phil Gyford 2017-10-11 18:40:55 +01:00
parent 5a008e7e77
commit d3f5361f4d

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import json import json
import os
from twython import Twython, TwythonError from twython import Twython, TwythonError
@ -11,7 +12,11 @@ class TestHtmlForTweetTestCase(unittest.TestCase):
self.api = Twython('', '', '', '') self.api = Twython('', '', '', '')
def load_tweet(self, name): def load_tweet(self, name):
f = open('tests/tweets/%s.json' % name) f = open(os.path.join(
os.path.dirname(__file__),
'tweets',
'%s.json' % name
))
tweet = json.load(f) tweet = json.load(f)
f.close() f.close()
return tweet return tweet