summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--M2Crypto/Engine.py2
-rw-r--r--M2Crypto/PGP/RSA.py2
-rw-r--r--M2Crypto/PGP/packet.py10
-rw-r--r--M2Crypto/SMIME.py2
-rw-r--r--M2Crypto/SSL/Checker.py4
-rw-r--r--M2Crypto/SSL/Connection.py2
-rw-r--r--M2Crypto/SSL/SSLServer.py2
-rw-r--r--M2Crypto/SSL/TwistedProtocolWrapper.py2
-rw-r--r--M2Crypto/SSL/__init__.py2
-rw-r--r--M2Crypto/SSL/cb.py14
-rw-r--r--M2Crypto/SSL/ssl_dispatcher.py2
-rw-r--r--M2Crypto/SSL/timeout.py1
-rw-r--r--M2Crypto/X509.py2
-rw-r--r--M2Crypto/__init__.py2
-rw-r--r--M2Crypto/m2urllib2.py6
-rw-r--r--contrib/dispatcher.py1
-rw-r--r--contrib/isaac.httpslib.py2
-rw-r--r--contrib/smimeplus.py8
-rw-r--r--tests/test_bio_iobuf.py1
-rw-r--r--tests/test_dh.py2
-rw-r--r--tests/test_ecdsa.py2
-rw-r--r--tests/test_engine.py2
-rw-r--r--tests/test_ssl.py29
-rw-r--r--tests/test_x509.py2
24 files changed, 44 insertions, 60 deletions
diff --git a/M2Crypto/Engine.py b/M2Crypto/Engine.py
index fa20a84..3518cc4 100644
--- a/M2Crypto/Engine.py
+++ b/M2Crypto/Engine.py
@@ -52,7 +52,7 @@ class Engine:
return m2.engine_finish(self._ptr)
def ctrl_cmd_string(self, cmd, arg, optional=0):
- # type: (bytes, bytes, int) -> int
+ # type: (bytes, Optional[bytes], int) -> int
"""Call ENGINE_ctrl_cmd_string"""
if not m2.engine_ctrl_cmd_string(self._ptr, cmd, arg, optional):
raise EngineError(Err.get_error())
diff --git a/M2Crypto/PGP/RSA.py b/M2Crypto/PGP/RSA.py
index 28c1409..16ec244 100644
--- a/M2Crypto/PGP/RSA.py
+++ b/M2Crypto/PGP/RSA.py
@@ -3,7 +3,7 @@
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
from M2Crypto import m2, util
-from M2Crypto.RSA import RSA, RSA_pub # noqa
+from M2Crypto.RSA import RSA_pub # noqa
if util.py27plus:
from typing import Tuple # noqa
diff --git a/M2Crypto/PGP/packet.py b/M2Crypto/PGP/packet.py
index f13feb6..f852031 100644
--- a/M2Crypto/PGP/packet.py
+++ b/M2Crypto/PGP/packet.py
@@ -93,12 +93,12 @@ class Packet:
def _llf(self, lenf):
# type: (int) -> Tuple[int, bytes]
if lenf < 256:
- return (0, chr(lenf))
+ return 0, chr(lenf)
elif lenf < 65536:
- return (1, struct.pack('>H', lenf))
+ return 1, struct.pack('>H', lenf)
else:
assert lenf < 2**32
- return (2, struct.pack('>L', lenf))
+ return 2, struct.pack('>L', lenf)
def _ctb(self, llf):
# type: (int) -> int
@@ -157,7 +157,7 @@ class TrustPacket(Packet): # noqa
class UserIDPacket(Packet): # noqa
def __init__(self, ctb, body=None):
- # type: (int, Optional[int]) -> None
+ # type: (int, Optional[str]) -> None
Packet.__init__(self, ctb, body)
if body is not None:
self._userid = body
@@ -313,7 +313,7 @@ class CompressedPacket(Packet): # noqa
def validate(self):
# type: () -> bool
- return (self.algo == '\001')
+ return self.algo == '\001'
def uncompress(self):
# type: () -> IO[bytes]
diff --git a/M2Crypto/SMIME.py b/M2Crypto/SMIME.py
index 36fb151..84d9bcd 100644
--- a/M2Crypto/SMIME.py
+++ b/M2Crypto/SMIME.py
@@ -152,7 +152,7 @@ class SMIME_Error(Exception): # noqa
m2.smime_init(SMIME_Error)
-
+# FIXME class has no __init__ method
class SMIME:
def load_key(self, keyfile, certfile=None,
callback=util.passphrase_callback):
diff --git a/M2Crypto/SSL/Checker.py b/M2Crypto/SSL/Checker.py
index 2f27cdf..1dde2a4 100644
--- a/M2Crypto/SSL/Checker.py
+++ b/M2Crypto/SSL/Checker.py
@@ -84,7 +84,7 @@ class Checker:
if self.fingerprint:
if self.digest not in ('sha1', 'md5'):
- raise ValueError('unsupported digest "%s"' % (self.digest))
+ raise ValueError('unsupported digest "%s"' % self.digest)
if self.digest == 'sha1':
expected_len = 40
@@ -256,7 +256,7 @@ class Checker:
# Massage certHost so that it can be used in regex
certHost = certHost.replace('.', '\.')
certHost = certHost.replace('*', '[^\.]*')
- if re.compile('^%s$' % (certHost)).match(host):
+ if re.compile('^%s$' % certHost).match(host):
return True
return False
diff --git a/M2Crypto/SSL/Connection.py b/M2Crypto/SSL/Connection.py
index d83ad0a..e82ed3d 100644
--- a/M2Crypto/SSL/Connection.py
+++ b/M2Crypto/SSL/Connection.py
@@ -598,7 +598,7 @@ class Connection:
def get_version(self):
# type: () -> str
- "Return the TLS/SSL protocol version for this connection."
+ """Return the TLS/SSL protocol version for this connection."""
return m2.ssl_get_version(self.ssl)
def set_post_connection_check_callback(self, postConnectionCheck): # noqa
diff --git a/M2Crypto/SSL/SSLServer.py b/M2Crypto/SSL/SSLServer.py
index 5d69e22..adaf7c7 100644
--- a/M2Crypto/SSL/SSLServer.py
+++ b/M2Crypto/SSL/SSLServer.py
@@ -8,7 +8,7 @@ Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved."""
from M2Crypto.SSL import SSLError
from M2Crypto.SSL.Connection import Connection
from M2Crypto.SSL.Context import Context # noqa
-from M2Crypto import m2, util # noqa
+from M2Crypto import util # noqa
from SocketServer import BaseServer, ForkingMixIn, TCPServer, ThreadingMixIn
from socket import socket # noqa
if util.py27plus:
diff --git a/M2Crypto/SSL/TwistedProtocolWrapper.py b/M2Crypto/SSL/TwistedProtocolWrapper.py
index fb9b6be..33197d1 100644
--- a/M2Crypto/SSL/TwistedProtocolWrapper.py
+++ b/M2Crypto/SSL/TwistedProtocolWrapper.py
@@ -374,7 +374,7 @@ class TLSProtocolWrapper(ProtocolWrapper):
if r <= 0:
assert(m2bio_should_retry(sslBioPtr))
else:
- assert(self.checked)
+ assert self.checked
self.data = self.data[r:]
pending = m2bio_ctrl_pending(networkBio)
diff --git a/M2Crypto/SSL/__init__.py b/M2Crypto/SSL/__init__.py
index 9c1e87d..847b87d 100644
--- a/M2Crypto/SSL/__init__.py
+++ b/M2Crypto/SSL/__init__.py
@@ -9,9 +9,11 @@ import socket
# M2Crypto
from M2Crypto import m2
+
class SSLError(Exception):
pass
+
class SSLTimeoutError(SSLError, socket.timeout):
pass
diff --git a/M2Crypto/SSL/cb.py b/M2Crypto/SSL/cb.py
index 8ae5c23..8112e04 100644
--- a/M2Crypto/SSL/cb.py
+++ b/M2Crypto/SSL/cb.py
@@ -8,7 +8,7 @@ import sys
from M2Crypto import m2, util
if util.py27plus:
- from typing import Any # noqa
+ from typing import Any, List # noqa
__all__ = ['unknown_issuer', 'ssl_verify_callback_stub', 'ssl_verify_callback',
'ssl_verify_callback_allow_unknown_ca', 'ssl_info_callback']
@@ -60,20 +60,20 @@ def ssl_info_callback(where, ret, ssl_ptr):
# type: (int, int, bytes) -> None
w = where & ~m2.SSL_ST_MASK
- if (w & m2.SSL_ST_CONNECT):
+ if w & m2.SSL_ST_CONNECT:
state = "SSL connect"
- elif (w & m2.SSL_ST_ACCEPT):
+ elif w & m2.SSL_ST_ACCEPT:
state = "SSL accept"
else:
state = "SSL state unknown"
- if (where & m2.SSL_CB_LOOP):
+ if where & m2.SSL_CB_LOOP:
sys.stderr.write("LOOP: %s: %s\n" %
(state, m2.ssl_get_state_v(ssl_ptr)))
sys.stderr.flush()
return
- if (where & m2.SSL_CB_EXIT):
+ if where & m2.SSL_CB_EXIT:
if not ret:
sys.stderr.write("FAILED: %s: %s\n" %
(state, m2.ssl_get_state_v(ssl_ptr)))
@@ -84,8 +84,8 @@ def ssl_info_callback(where, ret, ssl_ptr):
sys.stderr.flush()
return
- if (where & m2.SSL_CB_ALERT):
- if (where & m2.SSL_CB_READ):
+ if where & m2.SSL_CB_ALERT:
+ if where & m2.SSL_CB_READ:
w = 'read'
else:
w = 'write'
diff --git a/M2Crypto/SSL/ssl_dispatcher.py b/M2Crypto/SSL/ssl_dispatcher.py
index 2c5e7ad..ab7382e 100644
--- a/M2Crypto/SSL/ssl_dispatcher.py
+++ b/M2Crypto/SSL/ssl_dispatcher.py
@@ -9,7 +9,7 @@ import asyncore
import socket
# M2Crypto
-from M2Crypto import Err, m2, util # noqa
+from M2Crypto import util # noqa
from M2Crypto.SSL.Connection import Connection
from M2Crypto.SSL.Context import Context # noqa
diff --git a/M2Crypto/SSL/timeout.py b/M2Crypto/SSL/timeout.py
index 32d85dd..8241bb7 100644
--- a/M2Crypto/SSL/timeout.py
+++ b/M2Crypto/SSL/timeout.py
@@ -8,7 +8,6 @@ Copyright 2008 Heikki Toivonen. All rights reserved.
__all__ = ['DEFAULT_TIMEOUT', 'timeout', 'struct_to_timeout', 'struct_size']
import struct
-from M2Crypto import m2 # noqa
DEFAULT_TIMEOUT = 600 # type: int
diff --git a/M2Crypto/X509.py b/M2Crypto/X509.py
index 5b3d2c7..e812224 100644
--- a/M2Crypto/X509.py
+++ b/M2Crypto/X509.py
@@ -760,7 +760,7 @@ class X509:
return m2.x509_check_purpose(self.x509, id, ca)
def get_fingerprint(self, md='md5'):
- # type: (int) -> str
+ # type: (str) -> str
"""
Get the fingerprint of the certificate.
diff --git a/M2Crypto/__init__.py b/M2Crypto/__init__.py
index 3220685..642f27f 100644
--- a/M2Crypto/__init__.py
+++ b/M2Crypto/__init__.py
@@ -27,8 +27,6 @@ from M2Crypto import (ASN1, AuthCookie, BIO, BN, DH, DSA, EVP, Engine, Err,
PGP, RSA, Rand, SMIME, SSL, X509, m2crypto,
ftpslib, httpslib, m2, m2urllib, m2xmlrpclib,
threading, util)
-if util.py27plus:
- from typing import Tuple # noqa
if m2.OPENSSL_VERSION_NUMBER >= 0x90800F and m2.OPENSSL_NO_EC == 0:
from M2Crypto import EC
diff --git a/M2Crypto/m2urllib2.py b/M2Crypto/m2urllib2.py
index e5efa50..afc12c0 100644
--- a/M2Crypto/m2urllib2.py
+++ b/M2Crypto/m2urllib2.py
@@ -37,10 +37,10 @@ except AttributeError:
class _closing_fileobject(mother_class): # noqa
- '''socket._fileobject that propagates self.close() to the socket.
+ """socket._fileobject that propagates self.close() to the socket.
Python 2.5 provides this as socket._fileobject(sock, close=True).
- '''
+ """
# for python 3
try:
@@ -87,7 +87,7 @@ class HTTPSHandler(AbstractHTTPHandler):
full_url = req.get_full_url()
target_host = url_parse(full_url)[1]
- if (target_host != host):
+ if target_host != host:
request_uri = urldefrag(full_url)[0]
h = httpslib.ProxyHTTPSConnection(host=host, ssl_context=self.ctx)
else:
diff --git a/contrib/dispatcher.py b/contrib/dispatcher.py
index b0ee58f..6f3b0e0 100644
--- a/contrib/dispatcher.py
+++ b/contrib/dispatcher.py
@@ -22,6 +22,7 @@ class NBConnection(SSL.Connection):
def connect(self, addr):
self._setup_ssl(addr)
+ # FIXME SSL.Connection doesn't have _check_ssl_return method
return self._check_ssl_return(SSL.m2.ssl_connect(self.ssl))
def accept(self, addr):
diff --git a/contrib/isaac.httpslib.py b/contrib/isaac.httpslib.py
index e09e633..c5474b8 100644
--- a/contrib/isaac.httpslib.py
+++ b/contrib/isaac.httpslib.py
@@ -6,7 +6,7 @@ Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved."""
import string
-import SSL
+from M2Crypto import SSL
from httplib import FakeSocket, HTTP, HTTPConnection, HTTPResponse, HTTPS_PORT
diff --git a/contrib/smimeplus.py b/contrib/smimeplus.py
index 00ab038..9475ab0 100644
--- a/contrib/smimeplus.py
+++ b/contrib/smimeplus.py
@@ -91,7 +91,7 @@ class smimeplus(object):
_p7, _data = M2Crypto.SMIME.smime_load_pkcs7_bio(self.__pack(smsg))
try:
return _sender.verify(_p7, _data, flags=M2Crypto.SMIME.PKCS7_SIGNED)
- except M2Crypto.SMIME.SMIME_Error as _msg:
+ except M2Crypto.SMIME.SMIME_Error:
return None
def encrypt(self, rcert, msg):
@@ -133,7 +133,7 @@ class smimeplus(object):
# Decrypt p7.
try:
return _sender.decrypt(_p7)
- except M2Crypto.SMIME.SMIME_Error as _msg:
+ except M2Crypto.SMIME.SMIME_Error:
return None
def addHeader(self, rcert, content, subject=''):
@@ -157,14 +157,14 @@ class X509_Subject(UserDict.UserDict):
UserDict.UserDict.__init__(self)
try:
_data = substr.strip().split('/')
- except AttributeError as _msg:
+ except AttributeError:
pass
else:
for _i in _data:
try:
_k, _v = _i.split('=')
self[_k] = _v
- except ValueError as _msg:
+ except ValueError:
pass
diff --git a/tests/test_bio_iobuf.py b/tests/test_bio_iobuf.py
index e8038d5..8617c42 100644
--- a/tests/test_bio_iobuf.py
+++ b/tests/test_bio_iobuf.py
@@ -10,7 +10,6 @@ try:
except ImportError:
import unittest
-import M2Crypto
from M2Crypto.BIO import IOBuffer, MemoryBuffer
class IOBufferTestCase(unittest.TestCase):
diff --git a/tests/test_dh.py b/tests/test_dh.py
index a14d818..1ff5c35 100644
--- a/tests/test_dh.py
+++ b/tests/test_dh.py
@@ -9,7 +9,7 @@ try:
except ImportError:
import unittest
-from M2Crypto import DH, BIO, Rand, m2
+from M2Crypto import DH, BIO, Rand
class DHTestCase(unittest.TestCase):
diff --git a/tests/test_ecdsa.py b/tests/test_ecdsa.py
index 878a190..4cd2f0a 100644
--- a/tests/test_ecdsa.py
+++ b/tests/test_ecdsa.py
@@ -13,7 +13,7 @@ try:
except ImportError:
import unittest
-from M2Crypto import EC, Rand, m2
+from M2Crypto import EC, Rand
from tests.test_ec_curves import tested_curve
diff --git a/tests/test_engine.py b/tests/test_engine.py
index e1e0c83..251e1fd 100644
--- a/tests/test_engine.py
+++ b/tests/test_engine.py
@@ -7,7 +7,7 @@ try:
except ImportError:
import unittest
-from M2Crypto import Engine, m2
+from M2Crypto import Engine
class EngineTestCase(unittest.TestCase):
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 5695a71..ed2d3ea 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -31,7 +31,8 @@ try:
except ImportError:
import unittest
-from M2Crypto import Err, Rand, SSL, m2, util
+from M2Crypto import (Err, Rand, SSL, X509, ftpslib, httpslib, m2, m2urllib,
+ m2urllib2, m2xmlrpclib, util)
from tests import plat_fedora
from tests.fips import fips_mode
@@ -81,7 +82,7 @@ class VerifyCB:
def __call__(self, ok, store):
return verify_cb_new_function(ok, store)
-sleepTime = float(os.getenv('M2CRYPTO_TEST_SSL_SLEEP', 1.5))
+sleepTime = float(os.getenv('M2CRYPTO_TEST_SSL_SLEEP', '1.5'))
def find_openssl():
@@ -161,7 +162,6 @@ class HttpslibSSLClientTestCase(BaseSSLClientTestCase):
def test_HTTPSConnection(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
c = httpslib.HTTPSConnection(srv_host, self.srv_port)
c.request('GET', '/')
data = c.getresponse().read()
@@ -173,7 +173,6 @@ class HttpslibSSLClientTestCase(BaseSSLClientTestCase):
def test_HTTPSConnection_resume_session(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
ctx = SSL.Context()
ctx.load_verify_locations(cafile='tests/ca.pem')
ctx.load_cert('tests/x509.pem')
@@ -212,7 +211,6 @@ class HttpslibSSLClientTestCase(BaseSSLClientTestCase):
def test_HTTPSConnection_secure_context(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
ctx = SSL.Context()
ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert,
9)
@@ -229,7 +227,6 @@ class HttpslibSSLClientTestCase(BaseSSLClientTestCase):
def test_HTTPSConnection_secure_context_fail(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
ctx = SSL.Context()
ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert,
9)
@@ -243,7 +240,6 @@ class HttpslibSSLClientTestCase(BaseSSLClientTestCase):
self.stop_server(pid)
def test_HTTPSConnection_illegalkeywordarg(self):
- from M2Crypto import httpslib
with self.assertRaises(ValueError):
httpslib.HTTPSConnection('example.org', badKeyword=True)
@@ -558,7 +554,6 @@ class MiscSSLClientTestCase(BaseSSLClientTestCase):
def verify_cb_old(self, ctx_ptr, x509_ptr, err, depth, ok):
try:
- from M2Crypto import X509
self.assertFalse(ok)
self.assertIn(err,
[m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
@@ -818,7 +813,6 @@ class UrllibSSLClientTestCase(BaseSSLClientTestCase):
def test_urllib(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import m2urllib
url = m2urllib.FancyURLopener()
url.addheader('Connection', 'close')
u = url.open('https://%s:%s/' % (srv_host, self.srv_port))
@@ -838,7 +832,6 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
def test_urllib2(self):
pid = self.start_server(self.args)
try:
- from M2Crypto import m2urllib2
opener = m2urllib2.build_opener()
opener.addheaders = [('Connection', 'close')]
u = opener.open('https://%s:%s/' % (srv_host, self.srv_port))
@@ -856,7 +849,6 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, 9)
ctx.load_verify_locations('tests/ca.pem')
- from M2Crypto import m2urllib2
opener = m2urllib2.build_opener(ctx)
opener.addheaders = [('Connection', 'close')]
u = opener.open('https://%s:%s/' % (srv_host, self.srv_port))
@@ -874,7 +866,6 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, 9)
ctx.load_verify_locations('tests/server.pem')
- from M2Crypto import m2urllib2
opener = m2urllib2.build_opener(ctx)
opener.addheaders = [('Connection', 'close')]
with self.assertRaises(SSL.SSLError):
@@ -887,7 +878,6 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
try:
ctx = SSL.Context()
- from M2Crypto import m2urllib2
opener = m2urllib2.build_opener(
ctx, m2urllib2.HTTPBasicAuthHandler())
m2urllib2.install_opener(opener)
@@ -903,14 +893,12 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
def test_urllib2_opener_handlers(self):
ctx = SSL.Context()
- from M2Crypto import m2urllib2
m2urllib2.build_opener(ctx, m2urllib2.HTTPBasicAuthHandler())
def test_urllib2_leak(self):
pid = self.start_server(self.args)
try:
import gc
- from M2Crypto import m2urllib2
o = m2urllib2.build_opener()
r = o.open('https://%s:%s/' % (srv_host, self.srv_port))
s = [r.fp._sock.fp]
@@ -919,8 +907,9 @@ class Urllib2SSLClientTestCase(BaseSSLClientTestCase):
finally:
self.stop_server(pid)
-@unittest.skipIf(not util.py27plus,
- "Twisted doesn't test well with Python 2.6")
+
+@unittest.skipUnless(util.py27plus,
+ "Twisted doesn't test well with Python 2.6")
class TwistedSSLClientTestCase(BaseSSLClientTestCase):
def test_timeout(self):
@@ -940,7 +929,6 @@ class TwistedSSLClientTestCase(BaseSSLClientTestCase):
# httpslib uses makefile to read the response
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
c = httpslib.HTTPSConnection(srv_host, self.srv_port)
c.putrequest('GET', '/')
c.putheader('Accept', 'text/html')
@@ -978,7 +966,6 @@ class TwistedSSLClientTestCase(BaseSSLClientTestCase):
self.args[self.args.index('-www')] = '-WWW'
pid = self.start_server(self.args)
try:
- from M2Crypto import httpslib
c = httpslib.HTTPSConnection(srv_host, self.srv_port)
c.putrequest('GET', '/' + FIFO_NAME)
c.putheader('Accept', 'text/html')
@@ -1008,6 +995,7 @@ class TwistedSSLClientTestCase(BaseSSLClientTestCase):
'Skipping twisted wrapper test because twisted not found')
return
+ # TODO Class must implement all abstract methods
class EchoClient(LineReceiver):
def connectionMade(self):
self.sendLine('GET / HTTP/1.0\n\n')
@@ -1052,14 +1040,12 @@ twisted_data = ''
class XmlRpcLibTestCase(unittest.TestCase):
def test_lib(self):
- from M2Crypto import m2xmlrpclib
m2xmlrpclib.SSL_Transport()
# XXX need server to test against
class FtpsLibTestCase(unittest.TestCase):
def test_lib(self):
- from M2Crypto import ftpslib
ftpslib.FTP_TLS()
# XXX need server to test against
@@ -1072,7 +1058,6 @@ class SessionTestCase(unittest.TestCase):
class FtpslibTestCase(unittest.TestCase):
def test_26_compat(self):
- from M2Crypto import ftpslib
f = ftpslib.FTP_TLS()
# 2.6 used to raise AttributeError:
with self.assertRaises(socket.gaierror):
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 2132e38..214213d 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -18,7 +18,7 @@ try:
except ImportError:
import unittest
-from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, util # noqa
+from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2 # noqa
log = logging.getLogger(__name__)