#NEWLINE# def _check_ioctl_mutate_len( self , nbytes = None ) : #NEWLINE# #INDENT# buf = array . array ( 'i' ) #NEWLINE# intsize = buf . itemsize #NEWLINE# ids = ( os . getpgrp ( ) , os . getsid ( 0 ) ) #NEWLINE# fill = ( - 12345 ) #NEWLINE# if ( nbytes is not None ) : #NEWLINE# #INDENT# buf . extend ( ( [ fill ] * ( nbytes // self ) ) ) #NEWLINE# self . assertEqual ( ( len ( buf ) * intsize ) , nbytes ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# buf . append ( fill ) #NEWLINE# #UNINDENT# with open ( '/dev/tty' , 'rb' ) as tty : #NEWLINE# #INDENT# r = fcntl . ioctl ( tty , termios . TIOCGPGRP , buf , 1 ) #NEWLINE# #UNINDENT# rpgrp = buf [ 0 ] #NEWLINE# self . assertEqual ( r , 0 ) #NEWLINE# self . assertIn ( rpgrp , ids )