From e923a3b4cc01cc0e7f129a4dc5f44a56309acbc2 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 4 Jan 2024 16:36:49 +0000 Subject: [PATCH 1/2] gh-113692: skip a test if multiprocessing isn't available. --- Lib/test/test_logging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 33db5d6443f6fd..e349dceaa639d2 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3924,7 +3924,10 @@ def test_90195(self): def test_111615(self): # See gh-111615 - import multiprocessing as mp + try: + import multiprocessing as mp + except ImportError: # see gh-113692 + raise unittest.SkipTest('multiprocessing not available, needed for this test') config = { 'version': 1, From 0cb39ea80f3b8f0c7ad78e9ec920d4109b3d88a4 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Fri, 5 Jan 2024 08:27:06 +0000 Subject: [PATCH 2/2] Use test support to import multiprocessing modules. --- Lib/test/test_logging.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index e349dceaa639d2..0be26981184213 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -43,6 +43,7 @@ import tempfile from test.support.script_helper import assert_python_ok, assert_python_failure from test import support +from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper @@ -3924,10 +3925,8 @@ def test_90195(self): def test_111615(self): # See gh-111615 - try: - import multiprocessing as mp - except ImportError: # see gh-113692 - raise unittest.SkipTest('multiprocessing not available, needed for this test') + import_helper.import_module('_multiprocessing') # see gh-113692 + mp = import_helper.import_module('multiprocessing') config = { 'version': 1,