]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-110335: asyncio test_unix_events cleans multiprocessing (GH-110336) (#110338)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 4 Oct 2023 10:33:14 +0000 (03:33 -0700)
committerGitHub <noreply@github.com>
Wed, 4 Oct 2023 10:33:14 +0000 (12:33 +0200)
gh-110335: asyncio test_unix_events cleans multiprocessing (GH-110336)

test_unix_events tests using the multiprocessing module now call
multiprocessing.util._cleanup_tests().
(cherry picked from commit 1337765225d7d593169205672e004f97e15237ec)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_asyncio/test_unix_events.py

index 7322be597ae2d2bd29b8f895492c771da275ef15..d2c8cba6acfa31c6766db4514a0a17a5b0f1e0e8 100644 (file)
@@ -4,6 +4,7 @@ import contextlib
 import errno
 import io
 import multiprocessing
+from multiprocessing.util import _cleanup_tests as multiprocessing_cleanup_tests
 import os
 import pathlib
 import signal
@@ -15,6 +16,7 @@ import time
 import unittest
 from unittest import mock
 import warnings
+
 from test import support
 from test.support import os_helper
 from test.support import socket_helper
@@ -1903,6 +1905,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
 
     @hashlib_helper.requires_hashdigest('md5')
     def test_fork_signal_handling(self):
+        self.addCleanup(multiprocessing_cleanup_tests)
+
         # Sending signal to the forked process should not affect the parent
         # process
         ctx = multiprocessing.get_context('fork')
@@ -1947,6 +1951,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
 
     @hashlib_helper.requires_hashdigest('md5')
     def test_fork_asyncio_run(self):
+        self.addCleanup(multiprocessing_cleanup_tests)
+
         ctx = multiprocessing.get_context('fork')
         manager = ctx.Manager()
         self.addCleanup(manager.shutdown)
@@ -1964,6 +1970,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
 
     @hashlib_helper.requires_hashdigest('md5')
     def test_fork_asyncio_subprocess(self):
+        self.addCleanup(multiprocessing_cleanup_tests)
+
         ctx = multiprocessing.get_context('fork')
         manager = ctx.Manager()
         self.addCleanup(manager.shutdown)