summaryrefslogtreecommitdiff
path: root/Lib/test/test_poplib.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2018-05-16 17:50:29 -0400
committerGitHub <noreply@github.com>2018-05-16 17:50:29 -0400
commite5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3 (patch)
tree08165b95d947b31d76f1dcf8fb261a167becd181 /Lib/test/test_poplib.py
parent713a9367366c88662c39ed20dd6bce22399299f1 (diff)
downloadcpython-git-e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3.tar.gz
bpo-33522: Enable CI builds on Visual Studio Team Services (#6865)
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r--Lib/test/test_poplib.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index bf568bd77b..bbedbbdb10 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -179,7 +179,8 @@ class DummyPOP3Handler(asynchat.async_chat):
elif err.args[0] == ssl.SSL_ERROR_EOF:
return self.handle_close()
# TODO: SSLError does not expose alert information
- elif "SSLV3_ALERT_BAD_CERTIFICATE" in err.args[1]:
+ elif ("SSLV3_ALERT_BAD_CERTIFICATE" in err.args[1] or
+ "SSLV3_ALERT_CERTIFICATE_UNKNOWN" in err.args[1]):
return self.handle_close()
raise
except OSError as err:
@@ -222,11 +223,12 @@ class DummyPOP3Server(asyncore.dispatcher, threading.Thread):
def run(self):
self.active = True
self.__flag.set()
- while self.active and asyncore.socket_map:
- self.active_lock.acquire()
- asyncore.loop(timeout=0.1, count=1)
- self.active_lock.release()
- asyncore.close_all(ignore_all=True)
+ try:
+ while self.active and asyncore.socket_map:
+ with self.active_lock:
+ asyncore.loop(timeout=0.1, count=1)
+ finally:
+ asyncore.close_all(ignore_all=True)
def stop(self):
assert self.active