def __init__(self, buildnum, testcasePool, device): TestRunner.__init__(self, testcasePool, device) self.test_buildnum = buildnum self.currentBuildnum = self.getCurrentBuildNumber() if self.currentBuildnum <= 0 and buildnum < 0: msg = ( "Failed to get installed app's version number. Either you don't have the app installed, or the way " "you retrieve the version number is outdated." ) # printLog("{} [{}] {}".format(self.threadName, self.__class__.__name__, msg), logging.ERROR) raise RuntimeError(msg) printLog( "{} [{}] the current installed app's version is {}".format( self.threadName, self.__class__.__name__, self.currentBuildnum ), logging.DEBUG, ) if buildnum < 0: self.test_buildnum = self.currentBuildnum if self.currentBuildnum < self.test_buildnum: # upgrade app to target build if UPGRADE_APP_ON_TEST_START: printLog( self.threadName + "[%s] Upgrading device to build %s..." % (self.__class__.__name__, self.test_buildnum) ) assert self.updateApp() else: printLog( self.threadName + "[%s] Upgrade to build %s skipped..." % (self.__class__.__name__, self.test_buildnum) )
def __del__(self): TestRunner.__del__(self)