extmod/modtls: Move the native ssl module to tls.
The current `ssl` module has quite a few differences to the CPython implementation. This change moves the MicroPython variant to a new `tls` module and provides a wrapper module for `ssl` (in micropython-lib). Users who only rely on implemented comparible behavior can continue to use `ssl`, while users that rely on non-compatible behavior should switch to `tls`. Then we can make the facade in `ssl` more strictly adhere to CPython. Signed-off-by: Felix Dörre <felix@dogcraft.de>
This commit is contained in:
committed by
Damien George
parent
f8f1f29ac0
commit
b802f0f8ab
29
tests/extmod/tls_sslcontext_micropython.py
Normal file
29
tests/extmod/tls_sslcontext_micropython.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Test MicroPython-specific behaviour of tls.SSLContext.
|
||||
|
||||
try:
|
||||
import tls
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
# Test constructing without any arguments (in CPython it's a DeprecationWarning).
|
||||
try:
|
||||
tls.SSLContext()
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
||||
# Test attributes that don't exist (in CPython new attributes can be added).
|
||||
# This test is needed for coverage because SSLContext implements a custom attr handler.
|
||||
ctx = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT)
|
||||
try:
|
||||
ctx.does_not_exist
|
||||
except AttributeError:
|
||||
print("AttributeError on load")
|
||||
try:
|
||||
ctx.does_not_exist = None
|
||||
except AttributeError:
|
||||
print("AttributeError on store")
|
||||
try:
|
||||
del ctx.does_not_exist
|
||||
except AttributeError:
|
||||
print("AttributeError on delete")
|
||||
Reference in New Issue
Block a user