From: Oto Šťáva Date: Tue, 7 May 2024 14:41:42 +0000 (+0200) Subject: tests/pytests/utils: handle SSLEOFError X-Git-Tag: v5.7.3~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-develop-ci-o-45qdxc%2Fdeployments%2F4062;p=thirdparty%2Fknot-resolver.git tests/pytests/utils: handle SSLEOFError It used to just throw BrokenPipeError, but newer versions of Python have a separate exception for when the connection is closed in violation of TLS rules, which Knot Resolver does deliberately so as to not waste time on properly closing TLS connections with misbehaving peers. --- diff --git a/tests/pytests/utils.py b/tests/pytests/utils.py index 7792c047c..8af71aadf 100644 --- a/tests/pytests/utils.py +++ b/tests/pytests/utils.py @@ -99,7 +99,7 @@ def ping_alive(sock, msgid=None): @contextmanager def expect_kresd_close(rst_ok=False): - with pytest.raises(BrokenPipeError): + with pytest.raises((BrokenPipeError, ssl.SSLEOFError)): try: time.sleep(0.2) # give kresd time to close connection with TCP FIN yield