Skip to content

Commit b022e5c

Browse files
authored
bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked. Signed-off-by: Christian Heimes <[email protected]>
1 parent 50a48da commit b022e5c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import test.support
2727
import test.support.script_helper
2828
from test import support
29+
from test.support import hashlib_helper
2930
from test.support import socket_helper
3031
from test.support import threading_helper
3132

@@ -2954,6 +2955,8 @@ def test_remote(self):
29542955
# Make queue finalizer run before the server is stopped
29552956
del queue
29562957

2958+
2959+
@hashlib_helper.requires_hashdigest('md5')
29572960
class _TestManagerRestart(BaseTestCase):
29582961

29592962
@classmethod
@@ -3438,6 +3441,7 @@ def test_dont_merge(self):
34383441
#
34393442

34403443
@unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
3444+
@hashlib_helper.requires_hashdigest('md5')
34413445
class _TestPicklingConnections(BaseTestCase):
34423446

34433447
ALLOWED_TYPES = ('processes',)
@@ -3740,6 +3744,7 @@ def test_copy(self):
37403744

37413745

37423746
@unittest.skipUnless(HAS_SHMEM, "requires multiprocessing.shared_memory")
3747+
@hashlib_helper.requires_hashdigest('md5')
37433748
class _TestSharedMemory(BaseTestCase):
37443749

37453750
ALLOWED_TYPES = ('processes',)
@@ -4415,6 +4420,7 @@ def test_invalid_handles(self):
44154420

44164421

44174422

4423+
@hashlib_helper.requires_hashdigest('md5')
44184424
class OtherTest(unittest.TestCase):
44194425
# TODO: add more tests for deliver/answer challenge.
44204426
def test_deliver_challenge_auth_failure(self):
@@ -4451,6 +4457,7 @@ def send_bytes(self, data):
44514457
def initializer(ns):
44524458
ns.test += 1
44534459

4460+
@hashlib_helper.requires_hashdigest('md5')
44544461
class TestInitializers(unittest.TestCase):
44554462
def setUp(self):
44564463
self.mgr = multiprocessing.Manager()
@@ -5305,6 +5312,7 @@ def is_alive(self):
53055312
any(process.is_alive() for process in forked_processes))
53065313

53075314

5315+
@hashlib_helper.requires_hashdigest('md5')
53085316
class TestSyncManagerTypes(unittest.TestCase):
53095317
"""Test all the types which can be shared between a parent and a
53105318
child process by using a manager which acts as an intermediary
@@ -5699,6 +5707,8 @@ def install_tests_in_module_dict(remote_globs, start_method):
56995707
Mixin = local_globs[type_.capitalize() + 'Mixin']
57005708
class Temp(base, Mixin, unittest.TestCase):
57015709
pass
5710+
if type_ == 'manager':
5711+
Temp = hashlib_helper.requires_hashdigest('md5')(Temp)
57025712
Temp.__name__ = Temp.__qualname__ = newname
57035713
Temp.__module__ = __module__
57045714
remote_globs[newname] = Temp

Lib/test/test_concurrent_futures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Skip tests if sem_open implementation is broken.
77
support.import_module('multiprocessing.synchronize')
88

9+
from test.support import hashlib_helper
910
from test.support.script_helper import assert_python_ok
1011

1112
import contextlib
@@ -953,6 +954,7 @@ def test_traceback(self):
953954
self.assertIn('raise RuntimeError(123) # some comment',
954955
f1.getvalue())
955956

957+
@hashlib_helper.requires_hashdigest('md5')
956958
def test_ressources_gced_in_workers(self):
957959
# Ensure that argument for a job are correctly gc-ed after the job
958960
# is finished
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

0 commit comments

Comments
 (0)