From: Aaron Hill Date: Thu, 15 Aug 2013 11:45:45 +0000 (-0400) Subject: Added HTTP replaying for pull requests X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=afe19c28a7976ef75889ca0a21978fae4edf4413;p=tweepy.git Added HTTP replaying for pull requests --- diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a7e634e --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +httreplay==0.1.4 diff --git a/setup.py b/setup.py index 0f99cb5..9014c58 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,10 @@ #from distutils.core import setup from setuptools import setup, find_packages from tweepy import __version__ +from pip.req import parse_requirements + +install_reqs = parse_requirements('requirements.txt') +reqs = [str(req.req) for req in install_reqs] setup(name="tweepy", version=__version__, @@ -11,5 +15,6 @@ setup(name="tweepy", author_email="tweepy@googlegroups.com", url="http://github.com/tweepy/tweepy", packages = find_packages(), + install_requires=reqs, keywords= "twitter library", zip_safe = True) diff --git a/tests/test_api.py b/tests/test_api.py index 903647d..f2af053 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -9,6 +9,9 @@ from tweepy import (API, OAuthHandler, Friendship, Cursor, MemoryCache, FileCache) from config import * +from httreplay import start_replay, stop_replay +from httreplay.utils import filter_headers_key +import os test_tweet_id = '266367358078169089' @@ -30,12 +33,17 @@ class TweepyErrorTests(unittest.TestCase): class TweepyAPITests(unittest.TestCase): def setUp(self): + if os.environ['TRAVIS_SECURE_ENV_VARS'] == 'false': + start_replay('records/test.json', headers_key=filter_headers_key(['Authorization'])) auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret) auth.set_access_token(oauth_token, oauth_token_secret) self.api = API(auth) self.api.retry_count = 2 self.api.retry_delay = 5 + def tearDown(self): + stop_replay() + # TODO: Actually have some sort of better assertion def testgetoembed(self): data = self.api.get_oembed(test_tweet_id)