summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-05-08 14:49:09 (GMT)
committerGitHub <noreply@github.com>2022-05-08 14:49:09 (GMT)
commit086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0 (patch)
treea7b1eaf75879c3fded1b946b2331f6a45dfc8fc7 /Lib/test/test_socket.py
parent8f293180791f2836570bdfc29aadba04a538d435 (diff)
downloadcpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.zip
cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.tar.gz
cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.tar.bz2
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext().
Diffstat (limited to 'Lib/test/test_socket.py')
-rwxr-xr-xLib/test/test_socket.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 6133637..1aaa9e4 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -338,9 +338,7 @@ class ThreadableTest:
self.server_ready.set()
def _setUp(self):
- self.wait_threads = threading_helper.wait_threads_exit()
- self.wait_threads.__enter__()
- self.addCleanup(self.wait_threads.__exit__, None, None, None)
+ self.enterContext(threading_helper.wait_threads_exit())
self.server_ready = threading.Event()
self.client_ready = threading.Event()