From 5909c8eea5230067876878516d195c5950c0e43c Mon Sep 17 00:00:00 2001 From: Tore Lundqvist Date: Wed, 18 May 2016 15:25:13 -0400 Subject: [PATCH] Add support for Python 3.4 --- requirements-dev@3.4.txt | 6 ++++++ tests/base.py | 6 +++++- tests/test_service_oauth1.py | 8 ++++++-- tests/test_service_oauth2.py | 7 ++++++- tests/test_service_ofly.py | 8 ++++++-- tests/test_session.py | 7 ++++++- tox.ini | 8 +++++++- 7 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 requirements-dev@3.4.txt diff --git a/requirements-dev@3.4.txt b/requirements-dev@3.4.txt new file mode 100644 index 0000000..5a9f1cc --- /dev/null +++ b/requirements-dev@3.4.txt @@ -0,0 +1,6 @@ +coverage==4.0.3 +flake8==2.5.4 +nose==1.3.7 +pycrypto==2.6.1 +requests>=2.10.0 +yanc==0.3.3 diff --git a/tests/base.py b/tests/base.py index 251436c..8e9735c 100644 --- a/tests/base.py +++ b/tests/base.py @@ -6,6 +6,7 @@ Test suite common infrastructure. ''' +import sys import json import requests @@ -22,7 +23,10 @@ from inspect import stack, isfunction # NOQA -from mock import Mock # NOQA +if sys.version_info >= (3, 3): + from unittest.mock import Mock +else: + from mock import Mock # NOQA from nose.tools import nottest # NOQA diff --git a/tests/test_service_oauth1.py b/tests/test_service_oauth1.py index f32ccc6..abd9108 100644 --- a/tests/test_service_oauth1.py +++ b/tests/test_service_oauth1.py @@ -17,8 +17,6 @@ from copy import deepcopy from hashlib import sha1 -from mock import patch - import rauth import requests @@ -26,6 +24,12 @@ import json import pickle +import sys +if sys.version_info >= (3, 3): + from unittest.mock import patch +else: + from mock import patch + class OAuth1ServiceTestCase(RauthTestCase, RequestMixin, ServiceMixin, HttpMixin): diff --git a/tests/test_service_oauth2.py b/tests/test_service_oauth2.py index fc6849c..9f7c80f 100644 --- a/tests/test_service_oauth2.py +++ b/tests/test_service_oauth2.py @@ -14,13 +14,18 @@ from rauth.compat import parse_qsl, is_basestring from copy import deepcopy -from mock import patch import requests import json import pickle +import sys +if sys.version_info >= (3, 3): + from unittest.mock import patch +else: + from mock import patch + class OAuth2ServiceTestCase(RauthTestCase, RequestMixin, ServiceMixin, HttpMixin): diff --git a/tests/test_service_ofly.py b/tests/test_service_ofly.py index 4fecd0a..73f4a5d 100644 --- a/tests/test_service_ofly.py +++ b/tests/test_service_ofly.py @@ -18,12 +18,16 @@ from datetime import datetime from functools import wraps -from mock import patch - import requests import pickle +import sys +if sys.version_info >= (3, 3): + from unittest.mock import patch +else: + from mock import patch + class OflyServiceTestCase(RauthTestCase, RequestMixin, ServiceMixin, HttpMixin): diff --git a/tests/test_session.py b/tests/test_session.py index 4d69722..b985ba6 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -9,12 +9,17 @@ from base import RauthTestCase from rauth.session import OAuth1Session, OAuth2Session, OflySession -from mock import patch import requests import json +import sys +if sys.version_info >= (3, 3): + from unittest.mock import patch +else: + from mock import patch + class RequestMixin(object): def assert_ok(self, r): diff --git a/tox.ini b/tox.ini index dfaa94a..84a50c6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,11 @@ [tox] -envlist=py33,py27,py26,pypy +envlist=py34,py33,py27,py26,pypy + +[testenv:py34] +deps= + -r{toxinidir}/requirements-dev@3.4.txt +commands=flake8 rauth tests + ./run-tests.sh [testenv:py33] deps=