Skip to content

Commit

Permalink
Port to Python 3.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
judy2k committed Nov 15, 2014
1 parent 5b76b36 commit 0661dbf
Show file tree
Hide file tree
Showing 27 changed files with 3,248 additions and 125 deletions.
15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
*.pyc
*.swp
build/
dist/
tweepy.egg-info/
.env/
env.sh
.coverage
htmlcov/
.env
.idea
.pdbrc
.tox
build
dist
cassettes
htmlcov
tweepy.egg-info
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Stuart Powers
Jeff Hull (@jsh2134)
Mike (mikeandmore)
Kohei YOSHIDA

Mark Smith (@judy2k)
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Github and install it manually:
cd tweepy
python setup.py install

**Note** only Python 2.6 and 2.7 are supported at
the moment. The Python 3 family is not yet supported.
Python 2.6 and 2.7, 3.3 & 3.4 are supported.

Documentation
-------------
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests>=2.0.0
requests_oauthlib==0.4.0
requests==2.3.0
requests_oauthlib==0.4.1
six==1.7.3
3 changes: 1 addition & 2 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
if [[ $TRAVIS_BRANCH == "production" ]]; then
nosetests -v --with-coverage tests.test_api tests.test_streaming tests.test_cursors tests.test_utils
else
curl "https://dl.dropboxusercontent.com/u/231242/record.json" -o tests/record.json
USE_REPLAY=1 nosetests -v tests.test_api tests.test_utils
USE_REPLAY=1 nosetests -v --with-coverage tests.test_api tests.test_utils
fi
7 changes: 3 additions & 4 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
httreplay==0.1.4
coveralls==0.2
unittest2==0.5.1
tox>=1.7.2
vcrpy==1.0.2
mock==1.0.1
boto==2.27
unittest2 # Comment this line out if using Python 3.
31 changes: 17 additions & 14 deletions tests/config.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import os
import sys
from unittest2 import TestCase

from httreplay import start_replay, stop_replay
from httreplay.utils import filter_headers_key
import vcr

from tweepy.auth import OAuthHandler
from tweepy.api import API

import six
if six.PY3:
import unittest
else:
import unittest2 as unittest

username = os.environ.get('TWITTER_USERNAME', 'tweepytest')
oauth_consumer_key = os.environ.get('CONSUMER_KEY', '')
oauth_consumer_secret = os.environ.get('CONSUMER_SECRET', '')
oauth_token = os.environ.get('ACCESS_KEY', '')
oauth_token_secret = os.environ.get('ACCESS_SECRET', '')
use_replay = os.environ.get('USE_REPLAY', False)

class TweepyTestCase(TestCase):

tape = vcr.VCR(
cassette_library_dir='cassettes',
filter_headers=['Authorization'],
serializer='json',
# Either use existing cassettes, or never use recordings:
record_mode='new_episodes' if use_replay else 'all',
)


class TweepyTestCase(unittest.TestCase):
def setUp(self):
self.auth = create_auth()
self.api = API(self.auth)
self.api.retry_count = 2
self.api.retry_delay = 5

if use_replay:
def filter_body(data): return ''
start_replay('tests/record.json',
headers_key=filter_headers_key(['Authorization']),
body_key=filter_body)

def tearDown(self):
if use_replay:
stop_replay()

def create_auth():
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
Expand Down
2,903 changes: 2,903 additions & 0 deletions tests/record.json

Large diffs are not rendered by default.

Loading

0 comments on commit 0661dbf

Please sign in to comment.