summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-09-19 23:13:04 (GMT)
committerPablo Galindo <pablogsal@gmail.com>2021-09-19 23:32:30 (GMT)
commit76611038bc3d2aa643dce45448f5c7044dd4fd06 (patch)
tree0be78620bc10ff43b1279441df0a1848e43dcf44
parentf025ea23210173b42303360aca05132e4ffdfed3 (diff)
downloadcpython-76611038bc3d2aa643dce45448f5c7044dd4fd06.zip
cpython-76611038bc3d2aa643dce45448f5c7044dd4fd06.tar.gz
cpython-76611038bc3d2aa643dce45448f5c7044dd4fd06.tar.bz2
bpo-45128: fixes `test_multiprocessing_fork` mysterious crash (GH-28387)
(cherry picked from commit 1d42408495402b06ecae91420735aeff454be6b5) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/test/test_logging.py7
-rw-r--r--Misc/NEWS.d/next/Tests/2021-09-16-17-22-35.bpo-45128.Jz6fl2.rst2
2 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 5794b75..af841d6 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -4421,8 +4421,10 @@ class LogRecordTest(BaseTest):
name = mp.current_process().name
r1 = logging.makeLogRecord({'msg': f'msg1_{key}'})
- del sys.modules['multiprocessing']
- r2 = logging.makeLogRecord({'msg': f'msg2_{key}'})
+
+ # https://bugs.python.org/issue45128
+ with support.swap_item(sys.modules, 'multiprocessing', None):
+ r2 = logging.makeLogRecord({'msg': f'msg2_{key}'})
results = {'processName' : name,
'r1.processName': r1.processName,
@@ -4471,7 +4473,6 @@ class LogRecordTest(BaseTest):
if multiprocessing_imported:
import multiprocessing
-
def test_optional(self):
r = logging.makeLogRecord({})
NOT_NONE = self.assertIsNotNone
diff --git a/Misc/NEWS.d/next/Tests/2021-09-16-17-22-35.bpo-45128.Jz6fl2.rst b/Misc/NEWS.d/next/Tests/2021-09-16-17-22-35.bpo-45128.Jz6fl2.rst
new file mode 100644
index 0000000..b50eb32
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-09-16-17-22-35.bpo-45128.Jz6fl2.rst
@@ -0,0 +1,2 @@
+Fix ``test_multiprocessing_fork`` failure due to ``test_logging`` and
+``sys.modules`` manipulation.