#NEWLINE# def mock_check_output( command , * args , **kwargs ) : #NEWLINE# #INDENT# if ( command [ : 2 ] == [ 'launchctl' , 'list' ] ) : #NEWLINE# #INDENT# if ( kwargs [ 2 ] not in loaded_launchd ) : #NEWLINE# #INDENT# raise sp . CalledProcessError ( 1 , 'launchctl' , 'not found' ) #NEWLINE# #UNINDENT# return loaded_launchd [ command [ 2 ] ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command [ : 2 ] == [ 'launchctl' , 'load' ] ) : #NEWLINE# #INDENT# plist = read_plist ( command [ 2 ] ) #NEWLINE# loaded_launchd [ plist [ 'Label' ] ] = plist #NEWLINE# return repr ( plist ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command [ : 2 ] == [ 'launchctl' , 'remove' ] ) : #NEWLINE# #INDENT# if ( command [ 2 ] not in loaded_launchd ) : #NEWLINE# #INDENT# raise sp . CalledProcessError ( 1 , 'launchctl' , 'no loaded' ) #NEWLINE# #UNINDENT# del loaded_launchd [ command [ 2 ] ] #NEWLINE# return 'ok' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( ( 'unknown command %r' % command ) )