mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user