summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsiaoming Yang <me@lepture.com>2018-09-14 20:03:06 +0900
committerGitHub <noreply@github.com>2018-09-14 20:03:06 +0900
commita49c773fe4a7e0912a19057cb783e3a71b46435c (patch)
tree4d85eddbd1667c00eb34a4a3116a5ef82e84d9e2
parent73b952f83df14231f1b33561c0670404bd2ac3cc (diff)
parent1b4fa60945022a1d8739d5ed6a9a915230fd1e5b (diff)
downloadoauthlib-a49c773fe4a7e0912a19057cb783e3a71b46435c.tar.gz
Merge pull request #590 from jdufresne/unittest2
Remove workarounds for unsupported Python 2.6
-rwxr-xr-xsetup.py7
-rw-r--r--tests/unittest/__init__.py21
-rw-r--r--tox.ini4
3 files changed, 5 insertions, 27 deletions
diff --git a/setup.py b/setup.py
index 1d69e0d..17dcd7b 100755
--- a/setup.py
+++ b/setup.py
@@ -18,10 +18,9 @@ def fread(fn):
with open(join(dirname(__file__), fn), 'r') as f:
return f.read()
-if sys.version_info[0] == 3:
- tests_require = ['nose', 'cryptography', 'pyjwt>=1.0.0', 'blinker']
-else:
- tests_require = ['nose', 'unittest2', 'cryptography', 'mock>=2.0', 'pyjwt>=1.0.0', 'blinker']
+tests_require = ['nose', 'cryptography', 'pyjwt>=1.0.0', 'blinker']
+if sys.version_info[0] == 2:
+ tests_require.append('mock>=2.0')
rsa_require = ['cryptography']
signedtoken_require = ['cryptography', 'pyjwt>=1.0.0']
signals_require = ['blinker']
diff --git a/tests/unittest/__init__.py b/tests/unittest/__init__.py
index 35b239a..6cb79a6 100644
--- a/tests/unittest/__init__.py
+++ b/tests/unittest/__init__.py
@@ -1,32 +1,15 @@
import collections
import sys
+from unittest import TestCase
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
-try:
- # check the system path first
- from unittest2 import *
-except ImportError:
- if sys.version_info >= (2, 7):
- # unittest2 features are native in Python 2.7
- from unittest import *
- else:
- raise
-
-# Python 3.1 does not provide assertIsInstance
-if sys.version_info[1] == 1:
- TestCase.assertIsInstance = lambda self, obj, cls: self.assertTrue(isinstance(obj, cls))
# Somewhat consistent itemsequal between all python versions
-if sys.version_info[1] == 3:
+if sys.version_info[0] == 3:
TestCase.assertItemsEqual = TestCase.assertCountEqual
-elif sys.version_info[0] == 2 and sys.version_info[1] == 6:
- pass
-else:
- TestCase.assertItemsEqual = lambda self, a, b: self.assertEqual(
- collections.Counter(list(a)), collections.Counter(list(b)))
# URL comparison where query param order is insignifcant
diff --git a/tox.ini b/tox.ini
index eac7a1e..b736cf1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,10 +6,6 @@ deps=
-rrequirements-test.txt
commands=nosetests -s --with-coverage --cover-html --cover-html-dir={toxinidir}/htmlcov-{envname} --cover-erase --cover-package=oauthlib -w tests
-[testenv:py27]
-deps=unittest2
- {[testenv]deps}
-
# tox -e docs to mimick readthedocs build.
# as of today, RTD is using python2.7 and doesn't run "setup.py install"
[testenv:docs]