From ab50fc7d7d16ace9ae722e6119e3eb6454912c36 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 26 May 2020 07:58:09 +0200 Subject: [PATCH 1/2] bpo-17258: Add requires_hashdigest to multiprocessing tests Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked. Signed-off-by: Christian Heimes --- Lib/test/_test_multiprocessing.py | 10 ++++++++++ .../Tests/2020-05-26-07-53-31.bpo-17258.X_IKTQ.rst | 1 + 2 files changed, 11 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2020-05-26-07-53-31.bpo-17258.X_IKTQ.rst diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index dc8164f3288e1b..2f62a819bb01c0 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -25,6 +25,7 @@ import warnings import test.support import test.support.script_helper +from test.support import hashlib_helper from test import support from test.support import socket_helper @@ -2953,6 +2954,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 @@ -3437,6 +3440,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',) @@ -3739,6 +3743,7 @@ def test_copy(self): @unittest.skipUnless(HAS_SHMEM, "requires multiprocessing.shared_memory") +@hashlib_helper.requires_hashdigest('md5') class _TestSharedMemory(BaseTestCase): ALLOWED_TYPES = ('processes',) @@ -4414,6 +4419,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): @@ -4450,6 +4456,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() @@ -5302,6 +5309,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 @@ -5696,6 +5704,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 diff --git a/Misc/NEWS.d/next/Tests/2020-05-26-07-53-31.bpo-17258.X_IKTQ.rst b/Misc/NEWS.d/next/Tests/2020-05-26-07-53-31.bpo-17258.X_IKTQ.rst new file mode 100644 index 00000000000000..0a4b329b802e36 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-05-26-07-53-31.bpo-17258.X_IKTQ.rst @@ -0,0 +1 @@ +Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked. From 763b10d741d7a017f014d5cadc33e595139bf5fb Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 26 May 2020 11:08:57 +0200 Subject: [PATCH 2/2] bpo-17258: Skip concurrent.future multiprocessing test Signed-off-by: Christian Heimes --- Lib/test/_test_multiprocessing.py | 2 +- Lib/test/test_concurrent_futures.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 2f62a819bb01c0..b0768f8da70c45 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -25,8 +25,8 @@ import warnings import test.support import test.support.script_helper -from test.support import hashlib_helper from test import support +from test.support import hashlib_helper from test.support import socket_helper diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 40597ffee73786..bb2bc75dc08ac2 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -5,6 +5,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 @@ -952,6 +953,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