mirror of
https://github.com/python/cpython.git
synced 2025-08-16 06:40:56 +00:00
[3.12] gh-110335: asyncio test_unix_events cleans multiprocessing (GH-110336) (#110338)
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 1337765225
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
8939221e91
commit
1d87465005
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@ import contextlib
|
||||||
import errno
|
import errno
|
||||||
import io
|
import io
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
from multiprocessing.util import _cleanup_tests as multiprocessing_cleanup_tests
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import signal
|
import signal
|
||||||
|
@ -15,6 +16,7 @@ import time
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from test.support import socket_helper
|
from test.support import socket_helper
|
||||||
|
@ -1903,6 +1905,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
|
||||||
|
|
||||||
@hashlib_helper.requires_hashdigest('md5')
|
@hashlib_helper.requires_hashdigest('md5')
|
||||||
def test_fork_signal_handling(self):
|
def test_fork_signal_handling(self):
|
||||||
|
self.addCleanup(multiprocessing_cleanup_tests)
|
||||||
|
|
||||||
# Sending signal to the forked process should not affect the parent
|
# Sending signal to the forked process should not affect the parent
|
||||||
# process
|
# process
|
||||||
ctx = multiprocessing.get_context('fork')
|
ctx = multiprocessing.get_context('fork')
|
||||||
|
@ -1947,6 +1951,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
|
||||||
|
|
||||||
@hashlib_helper.requires_hashdigest('md5')
|
@hashlib_helper.requires_hashdigest('md5')
|
||||||
def test_fork_asyncio_run(self):
|
def test_fork_asyncio_run(self):
|
||||||
|
self.addCleanup(multiprocessing_cleanup_tests)
|
||||||
|
|
||||||
ctx = multiprocessing.get_context('fork')
|
ctx = multiprocessing.get_context('fork')
|
||||||
manager = ctx.Manager()
|
manager = ctx.Manager()
|
||||||
self.addCleanup(manager.shutdown)
|
self.addCleanup(manager.shutdown)
|
||||||
|
@ -1964,6 +1970,8 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
|
||||||
|
|
||||||
@hashlib_helper.requires_hashdigest('md5')
|
@hashlib_helper.requires_hashdigest('md5')
|
||||||
def test_fork_asyncio_subprocess(self):
|
def test_fork_asyncio_subprocess(self):
|
||||||
|
self.addCleanup(multiprocessing_cleanup_tests)
|
||||||
|
|
||||||
ctx = multiprocessing.get_context('fork')
|
ctx = multiprocessing.get_context('fork')
|
||||||
manager = ctx.Manager()
|
manager = ctx.Manager()
|
||||||
self.addCleanup(manager.shutdown)
|
self.addCleanup(manager.shutdown)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue