@@ -1617,13 +1617,29 @@ def bad_error(*args):
1617
1617
1618
1618
self .assertIn (repr (error_data ), str (e .exception ))
1619
1619
1620
-
1620
+ @unittest .skipIf (not os .path .exists ('/proc/self/status' ),
1621
+ "need /proc/self/status" )
1621
1622
def test_restore_signals (self ):
1622
- # Code coverage for both values of restore_signals to make sure it
1623
- # at least does not blow up.
1624
- # A test for behavior would be complex. Contributions welcome.
1625
- subprocess .call ([sys .executable , "-c" , "" ], restore_signals = True )
1626
- subprocess .call ([sys .executable , "-c" , "" ], restore_signals = False )
1623
+ # Blindly assume that cat exists on systems with /proc/self/status...
1624
+ default_proc_status = subprocess .check_output (
1625
+ ['cat' , '/proc/self/status' ],
1626
+ restore_signals = False )
1627
+ for line in default_proc_status .splitlines ():
1628
+ if line .startswith (b'SigIgn' ):
1629
+ default_sig_ign_mask = line
1630
+ break
1631
+ else :
1632
+ self .skipTest ("SigIgn not found in /proc/self/status." )
1633
+ restored_proc_status = subprocess .check_output (
1634
+ ['cat' , '/proc/self/status' ],
1635
+ restore_signals = True )
1636
+ for line in restored_proc_status .splitlines ():
1637
+ if line .startswith (b'SigIgn' ):
1638
+ restored_sig_ign_mask = line
1639
+ break
1640
+ self .assertNotEqual (default_sig_ign_mask , restored_sig_ign_mask ,
1641
+ msg = "restore_signals=True should've unblocked "
1642
+ "SIGPIPE and friends." )
1627
1643
1628
1644
def test_start_new_session (self ):
1629
1645
# For code coverage of calling setsid(). We don't care if we get an
0 commit comments