Skip to content

Commit facba2d

Browse files
committed
Reset SIGCONT handler to isolate test behavior
1 parent e8b697e commit facba2d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎Lib/test/test_pyrepl/test_unix_console.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,11 @@ def test_restore_in_thread(self, _os_write):
401401
thread.start()
402402
thread.join() # this should not raise
403403

404-
@unittest.skipIf(not hasattr(signal, "SIGCONT"), "needs signal.SIGCONT")
404+
@unittest.skipUnless(hasattr(signal, "SIGCONT"), "needs signal.SIGCONT")
405405
def test_sigcont_is_armed_only_by_prepare(self, _os_write):
406406
# gh-161254: A console must install its SIGCONT handler only while it
407407
# owns the terminal, i.e. between prepare() and restore().
408+
signal.signal(signal.SIGCONT, signal.SIG_DFL)
408409
console = UnixConsole(term="xterm")
409410
self.assertEqual(signal.getsignal(signal.SIGCONT), signal.SIG_DFL)
410411
console.prepare()
@@ -414,7 +415,7 @@ def test_sigcont_is_armed_only_by_prepare(self, _os_write):
414415
console.restore()
415416
self.assertEqual(signal.getsignal(signal.SIGCONT), signal.SIG_DFL)
416417

417-
@unittest.skipIf(not hasattr(signal, "SIGCONT"), "needs signal.SIGCONT")
418+
@unittest.skipUnless(hasattr(signal, "SIGCONT"), "needs signal.SIGCONT")
418419
def test_restore_without_prepare(self, _os_write):
419420
# gh-161254
420421
console = UnixConsole(term="xterm")

0 commit comments

Comments
 (0)