import time import sys reload(sys) sys.setdefaultencoding( "utf-8" ) try: import unittest2 as unittest except(ImportError): import unittest from lib import common, adbtools from lib import myuiautomator from lib import querydb DEVICE_NAME = querydb.get_uid(sys.argv[2]) class TestBrowser(unittest.TestCase): @classmethod def setUpClass(self): self.device = adbtools.AdbTools(DEVICE_NAME) common.unlock_screen(DEVICE_NAME) width, height = self.device.get_screen_normal_size() self.width = int(width) self.height = int(height) def setUp(self):
newParser = argparse.ArgumentParser() newParser.add_argument("-n", dest="rid", type=str, help="run id") args = newParser.parse_args() rid = args.rid # set up host connection ip = myglobal.common_config.getValue('IMAGEHOST', 'ip') username = myglobal.common_config.getValue('IMAGEHOST', 'username') passwd = myglobal.common_config.getValue('IMAGEHOST', 'passwd') remote_host = ssh.SSHAction(ip, username, passwd) # GET database info server_id = querydb.get_run_info(rid, "sid") mobile_id = querydb.get_run_info(rid, "mid") uid = querydb.get_uid(rid) vendor = querydb.get_vendor_name(rid).lower().strip() style = querydb.get_run_info(rid, 'style').lower() bport = querydb.get_mobile_status_info(mobile_id, server_id, "bport") port = querydb.get_mobile_status_info(mobile_id, server_id, "port") # update mobile status from free to busy querydb.update_mobile_status(rid, 'busy') # create remote path basic_img_path = querydb.get_run_info(rid, 'image_path') remote_filepath = '/diskb' + basic_img_path common.create_remote_path(remote_filepath) # create logger file and remote log name run_path = os.path.dirname(os.path.abspath(sys.argv[0]))