mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-23057: add loop self socket as wakeup fd for signals (#11135)
This commit is contained in:
parent
e3666fc8ef
commit
b5c8cfa1da
6 changed files with 104 additions and 6 deletions
|
@ -1,6 +1,9 @@
|
|||
import os
|
||||
import signal
|
||||
import socket
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
|
@ -13,6 +16,7 @@ import _winapi
|
|||
import asyncio
|
||||
from asyncio import windows_events
|
||||
from test.test_asyncio import utils as test_utils
|
||||
from test.support.script_helper import spawn_python
|
||||
|
||||
|
||||
def tearDownModule():
|
||||
|
@ -33,6 +37,23 @@ class UpperProto(asyncio.Protocol):
|
|||
self.trans.close()
|
||||
|
||||
|
||||
class ProactorLoopCtrlC(test_utils.TestCase):
|
||||
def test_ctrl_c(self):
|
||||
from .test_ctrl_c_in_proactor_loop_helper import __file__ as f
|
||||
|
||||
# ctrl-c will be sent to all processes that share the same console
|
||||
# in order to isolate the effect of raising ctrl-c we'll create
|
||||
# a process with a new console
|
||||
flags = subprocess.CREATE_NEW_CONSOLE
|
||||
with spawn_python(f, creationflags=flags) as p:
|
||||
try:
|
||||
exit_code = p.wait(timeout=5)
|
||||
self.assertEqual(exit_code, 255)
|
||||
except:
|
||||
p.kill()
|
||||
raise
|
||||
|
||||
|
||||
class ProactorTests(test_utils.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue