summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-11-20 08:19:32 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2017-11-20 21:19:32 +0800
commitc3697ad289dc011692591246e8d6d341f37da298 (patch)
tree4934d3daab2e7d9eb80af4528ceac6520a107666
parentfe0120f9fbf08ca937cc95cf409c0d888145fafa (diff)
downloadpyopenssl-c3697ad289dc011692591246e8d6d341f37da298.tar.gz
fix errors with latest flake8 (#710)
* fix errors with latest flake8 * Also fix the macOS builds * fix? * allow urllib3 to fail for now
-rw-r--r--.travis.yml8
-rw-r--r--examples/simple/server.py2
-rw-r--r--src/OpenSSL/SSL.py8
-rw-r--r--tests/test_crypto.py8
4 files changed, 15 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index d03d6f8..c76dc45 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -88,19 +88,23 @@ matrix:
- env: TOXENV=py35-cryptographyMaster
- env: TOXENV=py36-cryptographyMaster
- env: TOXENV=pypy-cryptographyMaster
+ # TODO: undo this once upstream fixes their tests
+ - python: "3.5"
+ env: TOXENV=py35-urllib3Master
+
install:
- |
if [[ "$(uname -s)" == 'Darwin' ]]; then
brew update
if [[ "${OPENSSL}" == "1.1.0" ]]; then
- brew install openssl@1.1
+ brew upgrade openssl@1.1
else
brew upgrade openssl
fi
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
- pip install --user virtualenv
+ python -m pip install --user virtualenv
else
# install our own pypy. This can be removed if and when Travis gets a reasonably up to date pypy
if [[ "${TOXENV}" = pypy* ]]; then
diff --git a/examples/simple/server.py b/examples/simple/server.py
index 9cce9e0..d25feb1 100644
--- a/examples/simple/server.py
+++ b/examples/simple/server.py
@@ -73,7 +73,7 @@ while 1:
r, w, _ = select.select(
[server] + list(clients.keys()), list(writers.keys()), []
)
- except:
+ except Exception:
break
for cli in r:
diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index 75d080a..667131b 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -307,10 +307,10 @@ class _NpnSelectHelper(_CallbackExceptionHelper):
instr = _ffi.buffer(in_, inlen)[:]
protolist = []
while instr:
- l = indexbytes(instr, 0)
- proto = instr[1:l + 1]
+ length = indexbytes(instr, 0)
+ proto = instr[1:length + 1]
protolist.append(proto)
- instr = instr[l + 1:]
+ instr = instr[length + 1:]
# Call the callback
outstr = callback(conn, protolist)
@@ -1080,7 +1080,7 @@ class Context(object):
if not push_result:
_lib.X509_NAME_free(copy)
_raise_current_error()
- except:
+ except Exception:
_lib.sk_X509_NAME_free(name_stack)
raise
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index 22a5c88..5642120 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -1846,11 +1846,11 @@ WpOdIpB8KksUTCzV591Nr1wd
cert = X509()
name = cert.get_subject()
name.C = 'AU'
- name.O = 'Unit Tests'
+ name.OU = 'Unit Tests'
cert.set_subject(name)
assert (
cert.get_subject().get_components() ==
- [(b'C', b'AU'), (b'O', b'Unit Tests')])
+ [(b'C', b'AU'), (b'OU', b'Unit Tests')])
def test_get_issuer(self):
"""
@@ -1882,11 +1882,11 @@ WpOdIpB8KksUTCzV591Nr1wd
cert = X509()
name = cert.get_issuer()
name.C = 'AU'
- name.O = 'Unit Tests'
+ name.OU = 'Unit Tests'
cert.set_issuer(name)
assert (
cert.get_issuer().get_components() ==
- [(b'C', b'AU'), (b'O', b'Unit Tests')])
+ [(b'C', b'AU'), (b'OU', b'Unit Tests')])
def test_get_pubkey_uninitialized(self):
"""