summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/alltests.py4
-rw-r--r--tests/test_bio.py3
-rw-r--r--tests/test_bio_ssl.py4
-rw-r--r--tests/test_ec_curves.py2
-rw-r--r--tests/test_evp.py3
-rw-r--r--tests/test_rc4.py3
-rw-r--r--tests/test_rsa.py3
-rw-r--r--tests/test_ssl.py5
-rw-r--r--tests/test_ssl_offline.py4
-rw-r--r--tests/test_ssl_win.py23
10 files changed, 31 insertions, 23 deletions
diff --git a/tests/alltests.py b/tests/alltests.py
index bdc9505..dfa8abb 100644
--- a/tests/alltests.py
+++ b/tests/alltests.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from __future__ import print_function
+from __future__ import absolute_import, print_function
def suite():
from M2Crypto import m2
@@ -94,7 +94,7 @@ def runall(report_leaks=0):
Rand.save_file('tests/randpool.dat')
finally:
if os.name == 'posix':
- from test_ssl import zap_servers
+ from .test_ssl import zap_servers
zap_servers()
if report_leaks:
diff --git a/tests/test_bio.py b/tests/test_bio.py
index ca71c49..8cbfc9d 100644
--- a/tests/test_bio.py
+++ b/tests/test_bio.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import absolute_import
"""
Unit tests for M2Crypto.BIO.
@@ -15,7 +16,7 @@ except ImportError:
from M2Crypto import BIO, Rand
-from fips import fips_mode
+from .fips import fips_mode
class CipherStreamTestCase(unittest.TestCase):
def try_algo(self, algo):
diff --git a/tests/test_bio_ssl.py b/tests/test_bio_ssl.py
index 518d79a..c44a2ec 100644
--- a/tests/test_bio_ssl.py
+++ b/tests/test_bio_ssl.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import print_function
+from __future__ import absolute_import, print_function
"""Unit tests for M2Crypto.BIO.File.
@@ -17,7 +17,7 @@ from M2Crypto import Err
from M2Crypto import Rand
from M2Crypto import threading as m2threading
-from test_ssl import srv_host, allocate_srv_port
+from .test_ssl import srv_host, allocate_srv_port
class HandshakeClient(threading.Thread):
diff --git a/tests/test_ec_curves.py b/tests/test_ec_curves.py
index 5dafcb8..1bffaff 100644
--- a/tests/test_ec_curves.py
+++ b/tests/test_ec_curves.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
# XXX memory leaks
+from __future__ import absolute_import
+
"""
Unit tests for M2Crypto.EC, the curves
diff --git a/tests/test_evp.py b/tests/test_evp.py
index c05d836..e5b0c9a 100644
--- a/tests/test_evp.py
+++ b/tests/test_evp.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import absolute_import
"""
Unit tests for M2Crypto.EVP.
@@ -17,7 +18,7 @@ except ImportError:
from M2Crypto import EVP, RSA, util, Rand, m2, BIO
from M2Crypto.util import h2b
-from fips import fips_mode
+from .fips import fips_mode
class EVPTestCase(unittest.TestCase):
def _gen_callback(self, *args):
diff --git a/tests/test_rc4.py b/tests/test_rc4.py
index 017324f..1b5dcf0 100644
--- a/tests/test_rc4.py
+++ b/tests/test_rc4.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import absolute_import
"""Unit tests for M2Crypto.RC4.
@@ -11,7 +12,7 @@ except ImportError:
from M2Crypto import RC4, Rand
from binascii import hexlify
-from fips import fips_mode
+from .fips import fips_mode
class RC4TestCase(unittest.TestCase):
diff --git a/tests/test_rsa.py b/tests/test_rsa.py
index aa6284a..9ae7709 100644
--- a/tests/test_rsa.py
+++ b/tests/test_rsa.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import absolute_import
"""Unit tests for M2Crypto.RSA.
@@ -14,7 +15,7 @@ except ImportError:
from M2Crypto import BIO, RSA, Rand, X509, m2
-from fips import fips_mode
+from .fips import fips_mode
log = logging.getLogger('test_RSA')
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index f9cabae..47130d5 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-
-from __future__ import print_function
+from __future__ import absolute_import, print_function
"""Unit tests for M2Crypto.SSL.
@@ -1174,5 +1173,5 @@ if __name__ == '__main__':
zap_servers()
if report_leaks:
- import alltests
+ from . import alltests
alltests.dump_garbage()
diff --git a/tests/test_ssl_offline.py b/tests/test_ssl_offline.py
index 60e3470..d409eea 100644
--- a/tests/test_ssl_offline.py
+++ b/tests/test_ssl_offline.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
"""Unit tests for M2Crypto.SSL offline parts
Copyright (C) 2006 Open Source Applications Foundation. All Rights Reserved.
@@ -12,7 +14,7 @@ except ImportError:
import unittest
from M2Crypto import Rand, SSL, X509
-from test_ssl import srv_host
+from .test_ssl import srv_host
class CheckerTestCase(unittest.TestCase):
diff --git a/tests/test_ssl_win.py b/tests/test_ssl_win.py
index 34e9835..b2bbddb 100644
--- a/tests/test_ssl_win.py
+++ b/tests/test_ssl_win.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import absolute_import
"""Unit tests for M2Crypto.SSL.
@@ -7,7 +8,9 @@ on your PATH.
Copyright (c) 2000-2001 Ng Pheng Siong. All rights reserved."""
-import os, os.path, string, time
+import os
+import os.path
+import time
try:
import unittest2 as unittest
except ImportError:
@@ -19,21 +22,20 @@ except ImportError:
win32process = None
if win32process:
- from M2Crypto import Rand, SSL
- import test_ssl
+ from M2Crypto import Rand
+ from . import test_ssl
def find_openssl():
plist = os.environ['PATH'].split(';')
for p in plist:
try:
- dir = os.listdir(p)
- if 'openssl.exe' in dir:
+ path_dir = os.listdir(p)
+ if 'openssl.exe' in path_dir:
return os.path.join(p, 'openssl.exe')
except WindowsError:
pass
return None
-
srv_host = 'localhost'
srv_port = 64000
@@ -47,9 +49,10 @@ if win32process:
# to find the .pem files
os.chdir('tests')
try:
- hproc, hthread, pid, tid = win32process.CreateProcess(self.openssl,
- string.join(args), None, None, 0, win32process.DETACHED_PROCESS,
- None, None, self.startupinfo)
+ hproc, _, _, _ = win32process.CreateProcess(
+ self.openssl, ' '.join(args), None, None, 0,
+ win32process.DETACHED_PROCESS, None, None,
+ self.startupinfo)
finally:
os.chdir('..')
time.sleep(0.3)
@@ -58,14 +61,12 @@ if win32process:
def stop_server(self, hproc):
win32process.TerminateProcess(hproc, 0)
-
def suite():
return unittest.makeSuite(SSLWinClientTestCase)
def zap_servers():
pass
-
if __name__ == '__main__':
try:
if find_openssl() is not None: