Skip to content

Commit

Permalink
bpo-17258: Add requires_hashdigest to multiprocessing tests (pythonGH…
Browse files Browse the repository at this point in the history
…-20412)

Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <[email protected]>
  • Loading branch information
tiran authored Jun 4, 2020
1 parent 50a48da commit b022e5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import test.support
import test.support.script_helper
from test import support
from test.support import hashlib_helper
from test.support import socket_helper
from test.support import threading_helper

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


@hashlib_helper.requires_hashdigest('md5')
class _TestManagerRestart(BaseTestCase):

@classmethod
Expand Down Expand Up @@ -3438,6 +3441,7 @@ def test_dont_merge(self):
#

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

ALLOWED_TYPES = ('processes',)
Expand Down Expand Up @@ -3740,6 +3744,7 @@ def test_copy(self):


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

ALLOWED_TYPES = ('processes',)
Expand Down Expand Up @@ -4415,6 +4420,7 @@ def test_invalid_handles(self):



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

@hashlib_helper.requires_hashdigest('md5')
class TestInitializers(unittest.TestCase):
def setUp(self):
self.mgr = multiprocessing.Manager()
Expand Down Expand Up @@ -5305,6 +5312,7 @@ def is_alive(self):
any(process.is_alive() for process in forked_processes))


@hashlib_helper.requires_hashdigest('md5')
class TestSyncManagerTypes(unittest.TestCase):
"""Test all the types which can be shared between a parent and a
child process by using a manager which acts as an intermediary
Expand Down Expand Up @@ -5699,6 +5707,8 @@ def install_tests_in_module_dict(remote_globs, start_method):
Mixin = local_globs[type_.capitalize() + 'Mixin']
class Temp(base, Mixin, unittest.TestCase):
pass
if type_ == 'manager':
Temp = hashlib_helper.requires_hashdigest('md5')(Temp)
Temp.__name__ = Temp.__qualname__ = newname
Temp.__module__ = __module__
remote_globs[newname] = Temp
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_concurrent_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Skip tests if sem_open implementation is broken.
support.import_module('multiprocessing.synchronize')

from test.support import hashlib_helper
from test.support.script_helper import assert_python_ok

import contextlib
Expand Down Expand Up @@ -953,6 +954,7 @@ def test_traceback(self):
self.assertIn('raise RuntimeError(123) # some comment',
f1.getvalue())

@hashlib_helper.requires_hashdigest('md5')
def test_ressources_gced_in_workers(self):
# Ensure that argument for a job are correctly gc-ed after the job
# is finished
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

0 comments on commit b022e5c

Please sign in to comment.