def waitForActiveTestToUnconfigure(self, timeout=60): ''' Wait for the active test state to be Unconfigured ''' counter = 0 while True: currentState = self.getActiveTestCurrentState() self.logInfo('waitForActiveTestToUnconfigure current state:', currentState) if counter <= timeout and currentState != 'Unconfigured': self.logInfo('ActiveTest current state = %s\nWaiting for state = Unconfigured: Wait %s/30' % (currentState, counter), timestamp=False) time.sleep(self.pollStatusInterval) counter += self.pollStatusInterval if counter <= timeout and currentState == 'Unconfigured': self.logInfo('\nActiveTest is Unconfigured') return 0 if counter >= timeout and currentState != 'Unconfigured': raise IxLoadRestApiException('ActiveTest is stuck at: {0}'.format(currentState))