Port eventlet.green.OpenSSL to Python 3

* Fix import syntax for Python 3: use relative imports
* Add unit test
This commit is contained in:
Victor Stinner 2015-06-29 16:03:56 +02:00 committed by Sergey Shepelev
parent 3ba7b02dfa
commit e9f19c6df4
2 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import rand
import crypto
import SSL
import tsafe
from version import __version__
from . import rand
from . import crypto
from . import SSL
from . import tsafe
from .version import __version__

17
tests/openssl_test.py Normal file
View File

@ -0,0 +1,17 @@
import tests
def test_import():
# https://github.com/eventlet/eventlet/issues/238
# Ensure that it's possible to import eventlet.green.OpenSSL.
# Most basic test to check Python 3 compatibility.
try:
import OpenSSL
except ImportError:
raise tests.SkipTest('need pyopenssl')
import eventlet.green.OpenSSL.SSL
import eventlet.green.OpenSSL.crypto
import eventlet.green.OpenSSL.rand
import eventlet.green.OpenSSL.tsafe
import eventlet.green.OpenSSL.version