示例#1
0
            else:
                runner = TestRunner(XMLTestReport(self.device))
        else:
            runner = TestRunner(EmptyTestReport(lambda tc: StreamResult()))
        runner.run(test_conf)


if __name__ == '__main__':
    #获取device_name参数
    device = None
    try:
        device = str(sys.argv[1])
    except:
        print "no devicename"
    if device == None:
        cfg_path = os.sep.join([util.getrootpath(), 'cfg', 'cfg.ini'])
        config = ConfigHelper(cfg_path)
        cfgfile = os.sep.join([util.getrootpath(), 'cfg', 'cfg.ini'])
        logfile = os.sep.join([util.getrootpath(), 'logs'])
    else:
        #根据device写入配置
        cfgfile = os.sep.join([util.getrootpath(), device, 'cfg', 'cfg.ini'])
        logfile = os.sep.join([util.getrootpath(), device, 'logs'])
    constant.cfg_path = cfgfile
    constant.log_path = logfile
    config = ConfigHelper(constant.cfg_path)
    cases = config.getValue('runtest', 'cases')
    cases = cases.split(',')
    runtest = RunTest(device)
    runtest.runtest(cases)
示例#2
0
#coding: utf8

from filelock import FileLock
#from time import sleep
import os
import utils.util as util
from utils.confighelper import ConfigHelper

cfg_path = os.sep.join([util.getrootpath(), 'cfg', 'user_account.ini'])
USER_DATA_PATH = cfg_path

def gimme_afree_account():
    
    free_user = None
    
    # 获取锁
    with FileLock(USER_DATA_PATH) as fl:
    # work with the file as it is now locked
    
        print("Lock acquired.")
    
        #sleep(10)
        import configparser
        config = configparser.ConfigParser()
        
        # 读配制
        config.read(fl.file_name)

        user_data = config['user']['data']
        # config = ConfigHelper(fl.file_name)
        # user_data = config['user']['data']