Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 196810a

Browse files
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]> (cherry picked from commit b022e5c) Co-authored-by: Christian Heimes <[email protected]>
1 parent 6d62dc1 commit 196810a

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

3132

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

2957+
2958+
@hashlib_helper.requires_hashdigest('md5')
29562959
class _TestManagerRestart(BaseTestCase):
29572960

29582961
@classmethod
@@ -3437,6 +3440,7 @@ def test_dont_merge(self):
34373440
#
34383441

34393442
@unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
3443+
@hashlib_helper.requires_hashdigest('md5')
34403444
class _TestPicklingConnections(BaseTestCase):
34413445

34423446
ALLOWED_TYPES = ('processes',)
@@ -3739,6 +3743,7 @@ def test_copy(self):
37393743

37403744

37413745
@unittest.skipUnless(HAS_SHMEM, "requires multiprocessing.shared_memory")
3746+
@hashlib_helper.requires_hashdigest('md5')
37423747
class _TestSharedMemory(BaseTestCase):
37433748

37443749
ALLOWED_TYPES = ('processes',)
@@ -4414,6 +4419,7 @@ def test_invalid_handles(self):
44144419

44154420

44164421

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

4459+
@hashlib_helper.requires_hashdigest('md5')
44534460
class TestInitializers(unittest.TestCase):
44544461
def setUp(self):
44554462
self.mgr = multiprocessing.Manager()
@@ -5304,6 +5311,7 @@ def is_alive(self):
53045311
any(process.is_alive() for process in forked_processes))
53055312

53065313

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

Lib/test/test_concurrent_futures.py

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

8+
from test.support import hashlib_helper
89
from test.support.script_helper import assert_python_ok
910

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

956+
@hashlib_helper.requires_hashdigest('md5')
955957
def test_ressources_gced_in_workers(self):
956958
# Ensure that argument for a job are correctly gc-ed after the job
957959
# 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)