tests: Require SSL certificate file to be available for test to run.

Previously, any test needing an SSL certificate file would automatically
skip if the file could not be found.  But that makes it too easy to
accidentally skip tests.

Instead, change it so that the test fails if the certificate file doesn't
exist.  That matches, for example, the fact that the test fails if
networking (LAN, WiFi) is not active.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-08-12 10:48:16 +10:00
parent a279c64046
commit 2bba507148
13 changed files with 0 additions and 88 deletions

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
async def handle_connection(reader, writer):
data = await reader.read(100)

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
async def handle_connection(reader, writer):
print("handle connection")

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
async def handle_connection(reader, writer):
data = await reader.readline()

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
async def handle_connection(reader, writer):
print("handle connection")

View File

@@ -13,13 +13,6 @@ PORT = 8000
certfile = "ec_cert.der"
keyfile = "ec_key.der"
try:
os.stat(certfile)
os.stat(keyfile)
except OSError:
print("SKIP")
raise SystemExit
with open(certfile, "rb") as cf:
cert = cadata = cf.read()

View File

@@ -13,13 +13,6 @@ PORT = 8000
certfile = "rsa_cert.der"
keyfile = "rsa_key.der"
try:
os.stat(certfile)
os.stat(keyfile)
except OSError:
print("SKIP")
raise SystemExit
with open(certfile, "rb") as cf:
cert = cadata = cf.read()

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
# Server
def instance0():

View File

@@ -15,13 +15,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
# Server
def instance0():

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
# Server
def instance0():

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "ec_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
# Server
def instance0():

View File

@@ -14,13 +14,6 @@ PORT = 8000
cert = cafile = "expired_cert.der"
key = "ec_key.der"
try:
os.stat(cafile)
os.stat(key)
except OSError:
print("SKIP")
raise SystemExit
# Server
def instance0():

View File

@@ -20,12 +20,6 @@ import asyncio
ca_cert_chain = "isrg.der"
try:
os.stat(ca_cert_chain)
except OSError:
print("SKIP")
raise SystemExit
with open(ca_cert_chain, "rb") as ca:
cadata = ca.read()

View File

@@ -13,11 +13,6 @@ import ssl
# $ openssl x509 -in mpycert.pem -out mpycert.der -outform DER
ca_cert_chain = "mpycert.der"
try:
os.stat(ca_cert_chain)
except OSError:
print("SKIP")
raise SystemExit
def main(use_stream=True):