Skip to content

Commit

Permalink
[3.12] pythongh-110335: asyncio test_unix_events cleans multiprocessi…
Browse files Browse the repository at this point in the history
…ng (pythonGH-110336) (python#110338)

pythongh-110335: asyncio test_unix_events cleans multiprocessing (pythonGH-110336)

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

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner committed Oct 4, 2023
1 parent 8939221 commit 1d87465
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import errno
import io
import multiprocessing
from multiprocessing.util import _cleanup_tests as multiprocessing_cleanup_tests
import os
import pathlib
import signal
Expand All @@ -15,6 +16,7 @@
import unittest
from unittest import mock
import warnings

from test import support
from test.support import os_helper
from test.support import socket_helper
Expand Down Expand Up @@ -1903,6 +1905,8 @@ async def test_fork_not_share_event_loop(self):

@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')
Expand Down Expand Up @@ -1947,6 +1951,8 @@ async def func():

@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)
Expand All @@ -1964,6 +1970,8 @@ async def child_main():

@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)
Expand Down

0 comments on commit 1d87465

Please sign in to comment.