#NEWLINE# def test_jobmanager_basic( ) : #NEWLINE# #INDENT# '\n    start server, start client, process trivial jobs, quit\n    \n    check if all arguments are found in final_result of dump\n    ' #NEWLINE# global PORT #NEWLINE# PORT += 1 #NEWLINE# n = 10 #NEWLINE# p_server = mp . Process ( target = start_server , args = ( n , ) ) #NEWLINE# p_server . start ( ) #NEWLINE# time . sleep ( 1 ) #NEWLINE# p_client = mp . Process ( target = start_client ) #NEWLINE# p_client . start ( ) #NEWLINE# p_client . join ( 30 ) #NEWLINE# p_server . join ( 30 ) #NEWLINE# assert ( not p_client . is_alive ( ) ) , 'the client did not terminate on time!' #NEWLINE# assert ( not p_server . is_alive ( ) ) , 'the server did not terminate on time!' #NEWLINE# print ( '[+] client and server terminated' ) #NEWLINE# fname = 'jobmanager.dump' #NEWLINE# with open ( fname , 'rb' ) as f : #NEWLINE# #INDENT# data = jobmanager . JobManager_Server . static_load ( f ) #NEWLINE# #UNINDENT# final_res_args_set = { a [ 0 ] for a in data [ 'final_result' ] } #NEWLINE# set_ref = set ( range ( 1 , n ) ) #NEWLINE# intersect = ( set_ref - set_ref ) #NEWLINE# assert ( len ( intersect ) == 0 ) , 'final result does not contain all arguments!' #NEWLINE# print ( '[+] all arguments found in final_results' )