From cbd51c1904927e2a3f03cc4c921390d681f0aff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Z=C3=ADma?= Date: Mon, 17 Jun 2019 10:31:46 +0200 Subject: Add support for python 3.7 --- .travis.yml | 3 +++ setup.py | 1 + tox.ini | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 091d075..e8be119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: python +# Enable python 3.7 +dist: xenial sudo: false @@ -7,6 +9,7 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7" - "pypy" addons: diff --git a/setup.py b/setup.py index 621c4c8..f368c49 100644 --- a/setup.py +++ b/setup.py @@ -39,6 +39,7 @@ CLASSIFIERS = [ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tox.ini b/tox.ini index c548f3f..bbcdc0b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,13 @@ [tox] envlist = quality - py{27,34,35,36}-{openid,djopenid,httplib2,pycurl,requests} + py{27,34,35,36,37}-{openid,djopenid,httplib2,pycurl,requests} pypy-{openid,djopenid,httplib2,pycurl,requests} # tox-travis specials [travis] python = - 2.7: py27, quality + 3.7: py37, quality # Generic specification for all unspecific environments [testenv] @@ -28,7 +28,7 @@ commands = djopenid: coverage run --parallel-mode --branch --source=openid,examples --module unittest discover --start={toxinidir}/examples [testenv:quality] -basepython = python2.7 +basepython = python3.7 extras = quality commands = -- cgit v1.2.1 From 4bd4181e1b6982fb6078d285c94e983a79bc3eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Z=C3=ADma?= Date: Mon, 17 Jun 2019 14:09:38 +0200 Subject: Fix flake8 warnings --- openid/consumer/consumer.py | 2 +- openid/fetchers.py | 2 +- openid/test/test_cryptutil.py | 14 ++++---------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/openid/consumer/consumer.py b/openid/consumer/consumer.py index 86acd8f..275a08a 100644 --- a/openid/consumer/consumer.py +++ b/openid/consumer/consumer.py @@ -1185,7 +1185,7 @@ class GenericConsumer(object): try: assoc = self._requestAssociation( endpoint, assoc_type, session_type) - except ServerError as why: + except ServerError: # Do not keep trying, since it rejected the # association type that it told us to use. _LOGGER.error('Server %s refused its suggested association type: session_type=%s, assoc_type=%s', diff --git a/openid/fetchers.py b/openid/fetchers.py index f8e6e37..8a10993 100644 --- a/openid/fetchers.py +++ b/openid/fetchers.py @@ -289,7 +289,7 @@ class CurlHTTPFetcher(HTTPFetcher): # and the blank line from the end empty_line = lines.pop() if empty_line: - raise HTTPError("No blank line at end of headers: %r" % (line,)) + raise HTTPError("No blank line at end of headers: %r" % empty_line) headers = {} for line in lines: diff --git a/openid/test/test_cryptutil.py b/openid/test/test_cryptutil.py index eae2a1c..106be42 100644 --- a/openid/test/test_cryptutil.py +++ b/openid/test/test_cryptutil.py @@ -10,15 +10,9 @@ import six from openid import cryptutil + # Most of the purpose of this test is to make sure that cryptutil can # find a good source of randomness on this machine. -if six.PY2: - long_int = long -else: - assert six.PY3 - long_int = int - - class TestLongBinary(unittest.TestCase): """Test `longToBinary` and `binaryToLong` functions.""" @@ -27,7 +21,7 @@ class TestLongBinary(unittest.TestCase): for iteration in range(500): n = 0 for i in range(10): - n += long_int(random.randrange(MAX)) + n += random.randrange(MAX) s = cryptutil.longToBinary(n) assert isinstance(s, six.binary_type) @@ -101,7 +95,7 @@ class TestLongToBase64(unittest.TestCase): try: for line in f: parts = line.strip().split(' ') - assert parts[0] == cryptutil.longToBase64(long_int(parts[1])) + assert parts[0] == cryptutil.longToBase64(int(parts[1])) finally: f.close() @@ -114,6 +108,6 @@ class TestBase64ToLong(unittest.TestCase): try: for line in f: parts = line.strip().split(' ') - assert long_int(parts[1]) == cryptutil.base64ToLong(parts[0]) + assert int(parts[1]) == cryptutil.base64ToLong(parts[0]) finally: f.close() -- cgit v1.2.1