summaryrefslogtreecommitdiff
path: root/tests/negtelnetserver.py
diff options
context:
space:
mode:
authorStefan Eissing <stefan@eissing.org>2022-11-11 16:39:06 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-11-14 08:50:51 +0100
commit00ea0aaf468a5bab96ea89eff172bd3c1f7e9fb2 (patch)
treef2adffbb0afae3018b6cdcb7efd32142eb444aee /tests/negtelnetserver.py
parent5f8351aea3b04e9692e0e256806eb968ad4d042b (diff)
downloadcurl-00ea0aaf468a5bab96ea89eff172bd3c1f7e9fb2.tar.gz
negtelnetserver.py: have it call its close() method
Closes #9894
Diffstat (limited to 'tests/negtelnetserver.py')
-rwxr-xr-xtests/negtelnetserver.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py
index 2b748aff3..afb9e3342 100755
--- a/tests/negtelnetserver.py
+++ b/tests/negtelnetserver.py
@@ -66,9 +66,9 @@ def telnetserver(options):
# Need to set the allow_reuse on the class, not on the instance.
socketserver.TCPServer.allow_reuse_address = True
- server = socketserver.TCPServer(local_bind, NegotiatingTelnetHandler)
- server.serve_forever()
-
+ with socketserver.TCPServer(local_bind, NegotiatingTelnetHandler) as server:
+ server.serve_forever()
+ # leaving `with` calls server.close() automatically
return ScriptRC.SUCCESS