Esempio n. 1
0
def create_kk_record_scene():
    """
    创建脚本录制场景
    :return:
    """
    try:
        directory, exe = _init()
    except BaseException as e:
        logging.exception(e)
        return False, str(e)
    scene_file = os.path.join(directory, 'src', 'scene')
    file_utils.rm(scene_file)
    cmd = exe + ' -c'
    _run_cmd(cmd)
    if not os.path.isfile(scene_file):
        return False, f'录制脚本场景创建失败, 未发现文件:{scene_file}'
    return True, config_utils.read_config(scene_file)
Esempio n. 2
0
def remove_visit_files(visit_info):
    rm(visit_info.ff_log)
    rm(visit_info.sys_log)
    tries = 0
    MAX_LOCK_CHECK = 30
    rm(visit_info.http_dump)
    if os.path.isdir(visit_info.profile_dir):
        # lock file means firefox is still running or didn't exit properly
        while os.path.isfile(join(visit_info.profile_dir, "lock")):
            time.sleep(1)
            tries += 1
            if tries > MAX_LOCK_CHECK:
                break
        if tries:
            cm.print_debug(visit_info,
                           "Waited %s sec for the lock to be removed" % tries)
        shutil.rmtree(visit_info.profile_dir, ignore_errors=True)
Esempio n. 3
0
def remove_visit_files(visit_info):
    rm(visit_info.ff_log)
    rm(visit_info.sys_log)
    tries = 0
    MAX_LOCK_CHECK = 30
    rm(visit_info.http_dump)
    if os.path.isdir(visit_info.profile_dir):
        # lock file means firefox is still running or didn't exit properly
        while os.path.isfile(join(visit_info.profile_dir, "lock")):
            time.sleep(1)
            tries += 1
            if tries > MAX_LOCK_CHECK:
                break
        if tries:
            cm.print_debug(visit_info,
                           "Waited %s sec for the lock to be removed" % tries)
        shutil.rmtree(visit_info.profile_dir, ignore_errors=True)
Esempio n. 4
0
 def tearDown(self):
     fu.rm(self.test_db)
Esempio n. 5
0
 def tearDownClass(cls):
     for f in cls.files_to_remove:  # remove test files
         if os.path.lexists(f):
             fu.rm(f)