Commit 0494119f authored by Hugo's avatar Hugo
Browse files

Remove redundant Python 2.6 and 3.3 code

parent 29e32cdf
...@@ -21,7 +21,7 @@ GitHub and install it manually: ...@@ -21,7 +21,7 @@ GitHub and install it manually:
cd tweepy cd tweepy
python setup.py install python setup.py install
Python 2.6 and 2.7, 3.3, 3.4, 3.5 & 3.6 are supported. Python 2.7, 3.4, 3.5 & 3.6 are supported.
Community Community
--------- ---------
......
...@@ -35,10 +35,8 @@ setup(name="tweepy", ...@@ -35,10 +35,8 @@ setup(name="tweepy",
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
......
tox>=1.7.2 tox>=1.7.2
vcrpy==1.10.3 vcrpy==1.10.3
mock==1.0.1 mock==1.0.1
unittest2 # Comment this line out if using Python 3.
import os import os
import unittest
import vcr import vcr
from tweepy.auth import OAuthHandler from tweepy.auth import OAuthHandler
from tweepy.api import API from tweepy.api import API
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
username = os.environ.get('TWITTER_USERNAME', 'tweepytest') username = os.environ.get('TWITTER_USERNAME', 'tweepytest')
oauth_consumer_key = os.environ.get('CONSUMER_KEY', '') oauth_consumer_key = os.environ.get('CONSUMER_KEY', '')
......
...@@ -3,13 +3,9 @@ from __future__ import absolute_import ...@@ -3,13 +3,9 @@ from __future__ import absolute_import
from .config import * from .config import *
from tweepy import API, OAuthHandler from tweepy import API, OAuthHandler
import six
import random import random
import unittest
if six.PY3:
import unittest
else:
import unittest2 as unittest
class TweepyAuthTests(unittest.TestCase): class TweepyAuthTests(unittest.TestCase):
......
from tweepy import Cursor from tweepy import Cursor
from .config import create_auth from .config import TweepyTestCase, username, tape
from .config import TweepyTestCase, username, use_replay, tape
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
class TweepyCursorTests(TweepyTestCase): class TweepyCursorTests(TweepyTestCase):
......
import unittest
import os import os
import unittest
from tweepy import API, Cursor from tweepy import API
from tweepy.error import TweepError from tweepy.error import TweepError
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
from .config import create_auth from .config import create_auth
testratelimit = 'TEST_RATE_LIMIT' in os.environ testratelimit = 'TEST_RATE_LIMIT' in os.environ
......
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from .config import tape
import six import six
if six.PY3: import unittest
import unittest from unittest.case import skip
from unittest.case import skip
else:
import unittest2 as unittest
from unittest2.case import skip
from tweepy.api import API from tweepy.api import API
from tweepy.auth import OAuthHandler from tweepy.auth import OAuthHandler
......
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
from tweepy.utils import * from tweepy.utils import *
import random import random
import string import string
import unittest
def mock_tweet(): def mock_tweet():
"""Generate some random tweet text.""" """Generate some random tweet text."""
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# and then run "tox" from this directory. # and then run "tox" from this directory.
[tox] [tox]
envlist = py26, py27, py33, py34, py35, py36 envlist = py27, py34, py35, py36
[base] [base]
deps = deps =
...@@ -12,17 +12,6 @@ deps = ...@@ -12,17 +12,6 @@ deps =
vcrpy==1.0.2 vcrpy==1.0.2
mock==1.0.1 mock==1.0.1
[py2]
deps =
{[base]deps}
unittest2==0.5.1
[testenv:py27]
deps = {[py2]deps}
[testenv:py26]
deps = {[py2]deps}
[testenv] [testenv]
commands = nosetests -v tests.test_cursors tests.test_api tests.test_utils commands = nosetests -v tests.test_cursors tests.test_api tests.test_utils
deps = deps =
......
...@@ -7,7 +7,6 @@ from __future__ import print_function ...@@ -7,7 +7,6 @@ from __future__ import print_function
from datetime import datetime from datetime import datetime
import six import six
from six.moves.urllib.parse import quote
from email.utils import parsedate from email.utils import parsedate
...@@ -41,14 +40,7 @@ def import_simplejson(): ...@@ -41,14 +40,7 @@ def import_simplejson():
try: try:
import simplejson as json import simplejson as json
except ImportError: except ImportError:
try: import json
import json # Python 2.6+
except ImportError:
try:
# Google App Engine
from django.utils import simplejson as json
except ImportError:
raise ImportError("Can't load a json library")
return json return json
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment