File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -393,6 +393,7 @@ def restore(self):
393
393
394
394
if hasattr (self , 'old_sigwinch' ):
395
395
signal .signal (signal .SIGWINCH , self .old_sigwinch )
396
+ del self .old_sigwinch
396
397
397
398
def __sigwinch (self , signum , frame ):
398
399
self .height , self .width = self .getheightwidth ()
Original file line number Diff line number Diff line change @@ -44,3 +44,29 @@ def test_cmd_instantiation_crash():
44
44
('accept' , ['' ])
45
45
]
46
46
read_spec (spec , HistoricalTestReader )
47
+
48
+
49
+ def test_signal_failure (monkeypatch ):
50
+ import os
51
+ import pty
52
+ import signal
53
+ from pyrepl .unix_console import UnixConsole
54
+
55
+ def failing_signal (a , b ):
56
+ raise ValueError
57
+
58
+ def really_failing_signal (a , b ):
59
+ raise AssertionError
60
+
61
+ mfd , sfd = pty .openpty ()
62
+ try :
63
+ c = UnixConsole (sfd , sfd )
64
+ c .prepare ()
65
+ c .restore ()
66
+ monkeypatch .setattr (signal , 'signal' , failing_signal )
67
+ c .prepare ()
68
+ monkeypatch .setattr (signal , 'signal' , really_failing_signal )
69
+ c .restore ()
70
+ finally :
71
+ os .close (mfd )
72
+ os .close (sfd )
You can’t perform that action at this time.
0 commit comments