tests/multi_net: Fix skipping of SSLContext tests when .der don't exist.
The `sslcontext_server_client_ciphers.py` test was using stat to test for the .der files after it already tried to open them for reading. That is now fixed. And `sslcontext_server_client.py` is adjusted to use the same pattern for skipping the test. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
17f254df35
commit
e1fe62f4fc
@ -15,18 +15,14 @@ certfile = "ec_cert.der"
|
|||||||
keyfile = "ec_key.der"
|
keyfile = "ec_key.der"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.stat(certfile)
|
with open(certfile, "rb") as cf:
|
||||||
os.stat(keyfile)
|
cert = cadata = cf.read()
|
||||||
|
with open(keyfile, "rb") as kf:
|
||||||
|
key = kf.read()
|
||||||
except OSError:
|
except OSError:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
with open(certfile, "rb") as cf:
|
|
||||||
cert = cadata = cf.read()
|
|
||||||
|
|
||||||
with open(keyfile, "rb") as kf:
|
|
||||||
key = kf.read()
|
|
||||||
|
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
def instance0():
|
def instance0():
|
||||||
|
|||||||
@ -13,14 +13,12 @@ PORT = 8000
|
|||||||
# These are test certificates. See tests/README.md for details.
|
# These are test certificates. See tests/README.md for details.
|
||||||
cert = cafile = "ec_cert.der"
|
cert = cafile = "ec_cert.der"
|
||||||
key = "ec_key.der"
|
key = "ec_key.der"
|
||||||
|
|
||||||
|
try:
|
||||||
with open(cafile, "rb") as f:
|
with open(cafile, "rb") as f:
|
||||||
cadata = f.read()
|
cadata = f.read()
|
||||||
with open(key, "rb") as f:
|
with open(key, "rb") as f:
|
||||||
keydata = f.read()
|
keydata = f.read()
|
||||||
|
|
||||||
try:
|
|
||||||
os.stat(cafile)
|
|
||||||
os.stat(key)
|
|
||||||
except OSError:
|
except OSError:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user