diff --git a/limbo/testcases/webpki/topsites.py b/limbo/testcases/webpki/topsites.py index 03a61a6c..d396b1f9 100644 --- a/limbo/testcases/webpki/topsites.py +++ b/limbo/testcases/webpki/topsites.py @@ -25,7 +25,7 @@ ] -def _rename(name: str): +def _rename(name: str) -> Callable: def deco(f: Callable) -> Callable: f.__name__ = name return f @@ -33,12 +33,12 @@ def deco(f: Callable) -> Callable: return deco -def build_testcases(): +def build_testcases() -> None: for site in _TOPSITES: @testcase @_rename(site) - def _(builder: Builder): + def _(builder: Builder) -> None: # TODO: Figure out the docstring here at some point. ctx = SSL.Context(method=SSL.TLS_METHOD) ctx.load_verify_locations(cafile=certifi.where()) @@ -48,7 +48,9 @@ def _(builder: Builder): conn.connect((site, 443)) conn.do_handshake() - peer_chain = [Certificate(c.to_cryptography()) for c in conn.get_verified_chain()] + peer_chain = [ + Certificate(c.to_cryptography()) for c in (conn.get_verified_chain() or []) + ] builder = ( builder.server_validation() diff --git a/pyproject.toml b/pyproject.toml index 25d2af78..12ddd669 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ lint = [ "ruff < 0.1.6", "mypy >= 1.0", "types-pyyaml", + "types-pyOpenSSL", ] doc = [] test = []