#NEWLINE# @ retry_before_failing ( ) #NEWLINE# def test_pids( self ) : #NEWLINE# #INDENT# if SUNOS : #NEWLINE# #INDENT# cmd = [ 'ps' , '-A' , '-o' , 'pid' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cmd = [ 'ps' , 'ax' , '-o' , 'pid' ] #NEWLINE# #UNINDENT# p = get_test_subprocess ( self , stdout = subprocess . PIPE ) #NEWLINE# output = p . communicate ( ) [ 0 ] . strip ( ) #NEWLINE# assert ( p . poll ( ) == 0 ) #NEWLINE# if PY3 : #NEWLINE# #INDENT# output = str ( output , sys . stdout . encoding ) #NEWLINE# #UNINDENT# pids_ps = [ ] #NEWLINE# for line in output . split ( '\n' ) [ 1 : ] : #NEWLINE# #INDENT# if line : #NEWLINE# #INDENT# pid = int ( line . split ( ) [ 0 ] . strip ( ) ) #NEWLINE# pids_ps . append ( pid ) #NEWLINE# #UNINDENT# #UNINDENT# pids_ps . remove ( p . pid ) #NEWLINE# pids_psutil = psutil . pids ( ) #NEWLINE# pids_ps . sort ( ) #NEWLINE# pids_psutil . sort ( ) #NEWLINE# if ( OSX and ( 0 not in pids_ps ) ) : #NEWLINE# #INDENT# pids_ps . insert ( 0 , 0 ) #NEWLINE# #UNINDENT# if ( pids_ps != pids_psutil ) : #NEWLINE# #INDENT# difference = ( [ x for x in pids_psutil if ( x not in pids_ps ) ] + [ x for x in pids_ps if ( x not in pids_psutil ) ] ) #NEWLINE# self . fail ( ( 'difference: ' + str ( difference ) ) )