@@ -81,27 +81,19 @@ def kill_process(self):
8181 self .pid = None
8282
8383 @allure .step ('Attach Squish to Test Application' )
84- def attach (self ):
84+ def attach (self , timeout_sec : int = configs . timeouts . PROCESS_TIMEOUT_SEC ):
8585 LOG .info ('Attaching to AUT: localhost:%d' , self .port )
86- for i in range (3 ):
87- try :
88- SquishServer ().add_attachable_aut (self .aut_id , self .port )
89- if self .ctx is None :
90- self .ctx = context .get_context (self .aut_id )
91- else :
92- if self .ctx is None :
93- for j in range (3 ):
94- try :
95- context .get_context (self .aut_id )
96- except AttributeError :
97- continue
98-
99- squish .setApplicationContext (self .ctx )
100- assert squish .waitFor (lambda : self .ctx .isRunning , configs .timeouts .PROCESS_TIMEOUT_SEC )
101- except Exception as err :
102- LOG .error ('Failed to attach AUT: %s' , err )
103- self .stop ()
104- raise err
86+
87+ try :
88+ SquishServer ().add_attachable_aut (self .aut_id , self .port )
89+ if self .ctx is None :
90+ self .ctx = context .get_context (self .aut_id )
91+ squish .setApplicationContext (self .ctx )
92+ assert squish .waitFor (lambda : self .ctx .isRunning , configs .timeouts .PROCESS_TIMEOUT_SEC )
93+ except Exception as err :
94+ LOG .error ('Failed to attach AUT: %s' , err )
95+ self .stop ()
96+ raise err
10597 LOG .info ('Successfully attached AUT!' )
10698 return self
10799
@@ -141,7 +133,7 @@ def launch(self) -> 'AUT':
141133 return self
142134
143135 @allure .step ('Waiting for port' )
144- def wait (self , timeout : int = 3 , retries : int = 10 ):
136+ def wait (self , timeout : int = 1 , retries : int = 10 ):
145137 LOG .info ('Waiting for AUT port localhost:%d...' , self .port )
146138 try :
147139 wait_for_port ('localhost' , self .port , timeout , retries )
0 commit comments