Skip to content

Commit 42dabb4

Browse files
Restore the event loop policy in test_async()
Running an event loop sets it, and regrtest reports it as a change of the environment when the tests run in a single process.
1 parent d3da898 commit 42dabb4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/test/test_support.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,12 @@ def test_it(self, a):
10291029
# Running an asyncio event loop needs a working socket.
10301030
@support.requires_working_socket()
10311031
def test_async(self):
1032+
# Running an event loop sets the event loop policy, which regrtest
1033+
# reports as a change of the environment.
1034+
import asyncio.events
1035+
self.enterContext(
1036+
support.swap_attr(asyncio.events, '_event_loop_policy', None))
1037+
10321038
# An asynchronous test must be awaited: a synchronous wrapper would
10331039
# make it silently not run at all.
10341040
ran = []

0 commit comments

Comments
 (0)