summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-02 20:25:26 (GMT)
committerGitHub <noreply@github.com>2021-06-02 20:25:26 (GMT)
commit320eaa7f42b413cd5e5436ec92d4dc5ba150395f (patch)
treef79d52f3dc0c4db54438ee4d579a8e05e864f715 /Lib
parent8916633b768e08af6375c7be9ea6c8ba9b3962b0 (diff)
downloadcpython-320eaa7f42b413cd5e5436ec92d4dc5ba150395f.zip
cpython-320eaa7f42b413cd5e5436ec92d4dc5ba150395f.tar.gz
cpython-320eaa7f42b413cd5e5436ec92d4dc5ba150395f.tar.bz2
bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489)
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases (when the recv() method returns an empty string).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_ssl.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 0d38d77..2df6232 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -4460,11 +4460,18 @@ class TestPostHandshakeAuth(unittest.TestCase):
'(certificate required|EOF occurred)'
):
# receive CertificateRequest
- self.assertEqual(s.recv(1024), b'OK\n')
+ data = s.recv(1024)
+ if not data:
+ raise ssl.SSLError(1, "EOF occurred")
+ self.assertEqual(data, b'OK\n')
+
# send empty Certificate + Finish
s.write(b'HASCERT')
+
# receive alert
- s.recv(1024)
+ data = s.recv(1024)
+ if not data:
+ raise ssl.SSLError(1, "EOF occurred")
def test_pha_optional(self):
if support.verbose: