From d3f5361f4d58b693f013eeb07dd12b698cae5a58 Mon Sep 17 00:00:00 2001 From: Phil Gyford Date: Wed, 11 Oct 2017 18:40:55 +0100 Subject: [PATCH] Try to fix loading of JSON files in tests on Travis --- tests/test_html_for_tweet.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_html_for_tweet.py b/tests/test_html_for_tweet.py index cc49121..7331fa4 100644 --- a/tests/test_html_for_tweet.py +++ b/tests/test_html_for_tweet.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import json +import os from twython import Twython, TwythonError @@ -11,7 +12,11 @@ class TestHtmlForTweetTestCase(unittest.TestCase): self.api = Twython('', '', '', '') 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) f.close() return tweet