Skip to content

Drop support for Python 2.6 #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sudo: false
language: python
cache: pip
python:
- 2.6
- 2.7
- 3.3
- 3.4
Expand All @@ -12,7 +11,6 @@ install:
- pip install -r requirements.txt
- pip install requests-mock
- pip install coveralls
- if [[ $TRAVIS_PYTHON_VERSION == "2.6" ]]; then pip install unittest2; fi
script:
- coverage run --source=requests_oauthlib -m nose
after_success:
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
History
-------

UNRELEASED
++++++++++

- **Removed support for Python 2.6.**

v0.8.0 (14 February 2017)
+++++++++++++++++++++++++

Expand Down
12 changes: 3 additions & 9 deletions requests_oauthlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from .oauth1_auth import OAuth1
from .oauth1_session import OAuth1Session
from .oauth2_auth import OAuth2
Expand All @@ -11,12 +13,4 @@
'requests-oauthlib expects, please upgrade to 2.0.0 or later.')
raise Warning(msg % requests.__version__)

import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass

logging.getLogger('requests_oauthlib').addHandler(NullHandler())
logging.getLogger('requests_oauthlib').addHandler(logging.NullHandler())
23 changes: 7 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import sys
import re

try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import setup


# Get the version
version_regex = r'__version__ = ["\']([^"\']*)["\']'
Expand All @@ -24,20 +22,13 @@

APP_NAME = 'requests-oauthlib'

settings = dict()


# Publish Helper.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()

tests_require = ['mock', 'requests-mock']
if sys.version_info < (2, 7): # Python 2.6 or lower
tests_require.append('unittest2')


settings.update(
setup(
name=APP_NAME,
version=VERSION,
description='OAuthlib authentication support for Requests.',
Expand All @@ -57,7 +48,6 @@
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
Expand All @@ -66,8 +56,9 @@
'Programming Language :: Python :: 3.6',
),
zip_safe=False,
tests_require=tests_require,
tests_require=[
'mock',
'requests-mock',
],
test_suite='tests'
)

setup(**settings)
5 changes: 1 addition & 4 deletions tests/test_compliance_fixes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from __future__ import unicode_literals
try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase
from unittest import TestCase

import requests
import requests_mock
Expand Down
5 changes: 1 addition & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import requests_oauthlib
import oauthlib
import os.path
try:
from io import StringIO # python 3
except ImportError:
from StringIO import StringIO # python 2
from io import StringIO
import unittest


Expand Down
18 changes: 1 addition & 17 deletions tests/test_oauth1_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
import unittest
import sys
import requests
from io import StringIO

from oauthlib.oauth1 import SIGNATURE_TYPE_QUERY, SIGNATURE_TYPE_BODY
from oauthlib.oauth1 import SIGNATURE_RSA, SIGNATURE_PLAINTEXT
from requests_oauthlib import OAuth1Session

try:
from StringIO import StringIO
except ImportError:
from io import StringIO

try:
import cryptography
Expand All @@ -25,19 +22,6 @@
unicode_type = unicode
bytes_type = str

# Monkey patch Python 2.6 unittest
if not hasattr(unittest, 'SkipTest'):
unittest.SkipTest = RuntimeWarning
unittest.TestResult.real_add_error = unittest.TestResult.addError

def patched_addError(self, test, exc_info):
if exc_info[0] is RuntimeWarning:
print(str(exc_info[1]), end=' ', file=sys.stderr)
return
else:
self.real_add_error(test, exc_info)
unittest.TestResult.addError = patched_addError


TEST_RSA_KEY = (
"-----BEGIN RSA PRIVATE KEY-----\n"
Expand Down
5 changes: 1 addition & 4 deletions tests/test_oauth2_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import time
from base64 import b64encode
from copy import deepcopy
try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase
from unittest import TestCase

from oauthlib.common import urlencode
from oauthlib.oauth2 import TokenExpiredError, OAuth2Error
Expand Down
11 changes: 1 addition & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py33, py34, py35, py36, pypy
envlist = py27, py33, py34, py35, py36, pypy

[testenv]
deps=
Expand All @@ -9,12 +9,3 @@ deps=
coveralls
requests-mock
commands= coverage run --source=requests_oauthlib -m nose

[testenv:py26]
deps=
-r{toxinidir}/requirements.txt
nose
mock
coveralls
unittest2
requests-mock