#NEWLINE# def test_failing_bots_do_not_crash_server( self ) : #NEWLINE# #INDENT# layout = '\n        ##########\n        #        #\n        #0  ..  1#\n        ##########\n        ' #NEWLINE# server = SimpleServer ( layout_string = layout , rounds = 5 , players = 2 , timeout_length = 0.3 ) #NEWLINE# for bind_address in server . bind_addresses : #NEWLINE# #INDENT# self . assertTrue ( bind_address . startswith ( 'tcp://' ) ) #NEWLINE# #UNINDENT# client1_address = server . bind_addresses [ 0 ] . replace ( '*' , 'localhost' ) #NEWLINE# client2_address = server . bind_addresses [ 1 ] . replace ( '*' , 'localhost' ) #NEWLINE# class ThisIsAnExpectedException ( Exception ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class FailingPlayer ( AbstractPlayer ) : #NEWLINE# #INDENT# def get_move( self ) : #NEWLINE# #INDENT# raise ThisIsAnExpectedException ( ) #NEWLINE# #UNINDENT# #UNINDENT# old_timeout = pelita . simplesetup . DEAD_CONNECTION_TIMEOUT #NEWLINE# pelita . simplesetup . DEAD_CONNECTION_TIMEOUT = 0.3 #NEWLINE# client1 = SimpleClient ( SimpleTeam ( 'team1' , FailingPlayer ( ) ) , address = client1_address ) #NEWLINE# client2 = SimpleClient ( SimpleTeam ( 'team2' , FailingPlayer ( ) ) , address = client2_address ) #NEWLINE# client1 . autoplay_process ( ) #NEWLINE# client2 . autoplay_process ( ) #NEWLINE# server . run ( ) #NEWLINE# server . shutdown ( ) #NEWLINE# pelita . simplesetup . DEAD_CONNECTION_TIMEOUT = old_timeout