Skip to content

Commit 1bfefba

Browse files
committed
Remove try .. finally which does not appear to be needed
1 parent c37e362 commit 1bfefba

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

aiosmtpd/tests/test_starttls.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -218,25 +218,20 @@ def test_eof_received(self, tls_controller, client):
218218
# I suspect it's a race condition, but with what, and how to prevent that from
219219
# happening, that's ... a mystery.
220220

221-
# Entering portion of code where hang is possible (upon assertion fail), so
222-
# we must wrap with "try..finally".
223-
try:
224-
code, mesg = client.ehlo("example.com")
225-
assert code == 250
226-
resp = client.starttls()
227-
assert resp == S.S220_READY_TLS
228-
# Need this to make SMTP update its internal session variable
229-
code, mesg = client.ehlo("example.com")
230-
assert code == 250
231-
sess: Sess_ = tls_controller.smtpd.session
232-
assert sess.ssl is not None
233-
client.noop()
234-
catchup_delay()
235-
handler: EOFingHandler = tls_controller.handler
236-
assert handler.ssl_existed is True
237-
assert handler.result is False
238-
finally:
239-
tls_controller.stop()
221+
code, mesg = client.ehlo("example.com")
222+
assert code == 250
223+
resp = client.starttls()
224+
assert resp == S.S220_READY_TLS
225+
# Need this to make SMTP update its internal session variable
226+
code, mesg = client.ehlo("example.com")
227+
assert code == 250
228+
sess: Sess_ = tls_controller.smtpd.session
229+
assert sess.ssl is not None
230+
client.noop()
231+
catchup_delay()
232+
handler: EOFingHandler = tls_controller.handler
233+
assert handler.ssl_existed is True
234+
assert handler.result is False
240235

241236
@handler_data(class_=ExceptionCaptureHandler)
242237
def test_tls_handshake_failing(self, tls_controller, client):

0 commit comments

Comments
 (0)