mirror of https://github.com/python/cpython.git
[3.10] Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) (GH-31255)
(cherry picked from commit 012e77eb5c
)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
parent
9b23f8f78f
commit
9f5145403b
|
@ -3,6 +3,10 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
class FutureTests(unittest.IsolatedAsyncioTestCase):
|
class FutureTests(unittest.IsolatedAsyncioTestCase):
|
||||||
async def test_recursive_repr_for_pending_tasks(self):
|
async def test_recursive_repr_for_pending_tasks(self):
|
||||||
# The call crashes if the guard for recursive call
|
# The call crashes if the guard for recursive call
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
# not needed for the test file but added for uniformness with all other
|
||||||
|
# asyncio test files for the sake of unified cleanup
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
class ProtocolsAbsTests(unittest.TestCase):
|
class ProtocolsAbsTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_base_protocol(self):
|
def test_base_protocol(self):
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
from test.test_asyncio import utils as test_utils
|
from test.test_asyncio import utils as test_utils
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
class TestPolicy(asyncio.AbstractEventLoopPolicy):
|
class TestPolicy(asyncio.AbstractEventLoopPolicy):
|
||||||
|
|
||||||
def __init__(self, loop_factory):
|
def __init__(self, loop_factory):
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
from test.support import socket_helper
|
from test.support import socket_helper
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
class MyProto(asyncio.Protocol):
|
class MyProto(asyncio.Protocol):
|
||||||
connected = None
|
connected = None
|
||||||
done = None
|
done = None
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
from asyncio import transports
|
from asyncio import transports
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
# not needed for the test file but added for uniformness with all other
|
||||||
|
# asyncio test files for the sake of unified cleanup
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
class TransportTests(unittest.TestCase):
|
class TransportTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_ctor_extra_is_none(self):
|
def test_ctor_extra_is_none(self):
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
from test.test_asyncio import utils as test_utils
|
from test.test_asyncio import utils as test_utils
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
asyncio.set_event_loop_policy(None)
|
||||||
|
|
||||||
|
|
||||||
MOCK_ANY = mock.ANY
|
MOCK_ANY = mock.ANY
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +43,6 @@ def SIGNAL(signum):
|
||||||
return 32768 - signum
|
return 32768 - signum
|
||||||
|
|
||||||
|
|
||||||
def tearDownModule():
|
|
||||||
asyncio.set_event_loop_policy(None)
|
|
||||||
|
|
||||||
|
|
||||||
def close_pipe_transport(transport):
|
def close_pipe_transport(transport):
|
||||||
# Don't call transport.close() because the event loop and the selector
|
# Don't call transport.close() because the event loop and the selector
|
||||||
# are mocked
|
# are mocked
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Prevent default asyncio event loop policy modification warning after
|
||||||
|
``test_asyncio`` execution.
|
Loading…
Reference in New Issue