File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88try :
99 tty = open ("/dev/tty" , "r" )
10- tty .close ()
1110except IOError :
1211 raise unittest .SkipTest ("Unable to open /dev/tty" )
12+ else :
13+ # Skip if another process is in foreground
14+ r = fcntl .ioctl (tty , termios .TIOCGPGRP , " " )
15+ tty .close ()
16+ rpgrp = struct .unpack ("i" , r )[0 ]
17+ if rpgrp not in (os .getpgrp (), os .getsid (0 )):
18+ raise unittest .SkipTest ("Neither the process group nor the session "
19+ "are attached to /dev/tty" )
20+ del tty , r , rpgrp
1321
1422try :
1523 import pty
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ Tools/Demos
136136Tests
137137-----
138138
139+ - Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
140+
139141- Issue #8433: Fix test_curses failure with newer versions of ncurses.
140142
141143- Issue #9496: Provide a test suite for the rlcompleter module. Patch by
You can’t perform that action at this time.
0 commit comments