Skip to content

Commit b9dcbe0

Browse files
authored
Fix comments
1 parent ce72fb3 commit b9dcbe0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/test/test_concurrent_futures/test_thread_pool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import multiprocessing.util
55
import os
66
import threading
7-
import warnings
87
import unittest
98
from concurrent import futures
109
from test import support
@@ -68,15 +67,15 @@ def submit(pool):
6867
workers.submit(tuple)
6968

7069
@support.requires_fork()
71-
@unittest.skipUnless(hasattr(os, "register_at_fork"), "need os.register_at_fork")
72-
@support.requires_resource("cpu")
70+
@unittest.skipUnless(hasattr(os, 'register_at_fork'), 'need os.register_at_fork')
71+
@support.requires_resource('cpu')
7372
def test_process_fork_from_a_threadpool(self):
7473
# bpo-43944: clear concurrent.futures.thread._threads_queues after fork,
7574
# otherwise child process will try to join parent thread
7675
def fork_process_and_return_exitcode():
7776
# Ignore the warning about fork with threads.
78-
with warnings.catch_warnings(category=DeprecationWarning, action="ignore"):
79-
p = mp.get_context("fork").Process(target=lambda: 1)
77+
with self.assertWarnsRegex(DeprecationWarning, msg="use of fork() may lead to deadlocks in child"):
78+
p = mp.get_context('fork').Process(target=lambda: 1)
8079
p.start()
8180
p.join()
8281
return p.exitcode

0 commit comments

Comments
 (0)