How to use the airtest.utils.compat.decode_path function in airtest

To help you get started, we’ve selected a few airtest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AirtestProject / Airtest / airtest / report / report.py View on Github external
def main(args):
    # script filepath
    path, name = script_dir_name(args.script)
    record_list = args.record or []
    log_root = decode_path(args.log_root) or decode_path(os.path.join(path, LOGDIR))
    static_root = args.static_root or STATIC_DIR
    static_root = decode_path(static_root)
    export = decode_path(args.export) if args.export else None
    lang = args.lang if args.lang in ['zh', 'en'] else 'en'
    plugins = args.plugins

    # gen html report
    rpt = LogToHtml(path, log_root, static_root, export_dir=export, script_name=name, lang=lang, plugins=plugins)
    rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
github AirtestProject / Airtest / airtest / report / report.py View on Github external
def main(args):
    # script filepath
    path, name = script_dir_name(args.script)
    record_list = args.record or []
    log_root = decode_path(args.log_root) or decode_path(os.path.join(path, LOGDIR))
    static_root = args.static_root or STATIC_DIR
    static_root = decode_path(static_root)
    export = decode_path(args.export) if args.export else None
    lang = args.lang if args.lang in ['zh', 'en'] else 'en'
    plugins = args.plugins

    # gen html report
    rpt = LogToHtml(path, log_root, static_root, export_dir=export, script_name=name, lang=lang, plugins=plugins)
    rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
github buffaloleo143 / airtest_runner / report.py View on Github external
def main(args):
	# script filepath
	path = decode_path(args.script)
	record_list = args.record or []
	log_root = decode_path(args.log_root) or path
	static_root = args.static_root or STATIC_DIR
	static_root = decode_path(static_root)
	export = args.export
	lang = args.lang if args.lang in ['zh', 'en'] else 'zh'
	plugins = args.plugins
	# gen html report
	rpt = R.LogToHtml(path, log_root, static_root, export_dir=export, lang=lang, plugins=plugins)
	# override methods
	rpt._make_export_dir = types.MethodType(_make_export_dir, rpt)
	rpt.report = types.MethodType(report, rpt)
	rpt.get_result = types.MethodType(get_result, rpt)
	rpt._translate_screen = types.MethodType(_translate_screen, rpt)
	rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
	return rpt.get_result()
github buffaloleo143 / airtest_runner / report.py View on Github external
def main(args):
	# script filepath
	path = decode_path(args.script)
	record_list = args.record or []
	log_root = decode_path(args.log_root) or path
	static_root = args.static_root or STATIC_DIR
	static_root = decode_path(static_root)
	export = args.export
	lang = args.lang if args.lang in ['zh', 'en'] else 'zh'
	plugins = args.plugins
	# gen html report
	rpt = R.LogToHtml(path, log_root, static_root, export_dir=export, lang=lang, plugins=plugins)
	# override methods
	rpt._make_export_dir = types.MethodType(_make_export_dir, rpt)
	rpt.report = types.MethodType(report, rpt)
	rpt.get_result = types.MethodType(get_result, rpt)
	rpt._translate_screen = types.MethodType(_translate_screen, rpt)
	rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
	return rpt.get_result()
github AirtestProject / Airtest / airtest / report / report.py View on Github external
def main(args):
    # script filepath
    path, name = script_dir_name(args.script)
    record_list = args.record or []
    log_root = decode_path(args.log_root) or decode_path(os.path.join(path, LOGDIR))
    static_root = args.static_root or STATIC_DIR
    static_root = decode_path(static_root)
    export = decode_path(args.export) if args.export else None
    lang = args.lang if args.lang in ['zh', 'en'] else 'en'
    plugins = args.plugins

    # gen html report
    rpt = LogToHtml(path, log_root, static_root, export_dir=export, script_name=name, lang=lang, plugins=plugins)
    rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
github AirtestProject / Airtest / airtest / core / android / adb.py View on Github external
filepath: full path to file to be installed on the device
            replace: force to replace existing application, default is False

                e.g.["-t",  # allow test packages
                    "-l",  # forward lock application,
                    "-s",  # install application on sdcard,
                    "-d",  # allow version code downgrade (debuggable packages only)
                    "-g",  # grant all runtime permissions
                ]

        Returns:
            command output

        """
        if isinstance(filepath, str):
            filepath = decode_path(filepath)

        if not os.path.isfile(filepath):
            raise RuntimeError("file: %s does not exists" % (repr(filepath)))

        if not install_options or type(install_options) != list:
            install_options = []
        if replace:
            install_options.append("-r")
        cmds = ["install", ] + install_options + [filepath, ]
        out = self.cmd(cmds)

        if re.search(r"Failure \[.*?\]", out):
            print(out)
            raise AirtestError("Installation Failure")

        return out
github buffaloleo143 / airtest_runner / report.py View on Github external
def main(args):
	# script filepath
	path = decode_path(args.script)
	record_list = args.record or []
	log_root = decode_path(args.log_root) or path
	static_root = args.static_root or STATIC_DIR
	static_root = decode_path(static_root)
	export = args.export
	lang = args.lang if args.lang in ['zh', 'en'] else 'zh'
	plugins = args.plugins
	# gen html report
	rpt = R.LogToHtml(path, log_root, static_root, export_dir=export, lang=lang, plugins=plugins)
	# override methods
	rpt._make_export_dir = types.MethodType(_make_export_dir, rpt)
	rpt.report = types.MethodType(report, rpt)
	rpt.get_result = types.MethodType(get_result, rpt)
	rpt._translate_screen = types.MethodType(_translate_screen, rpt)
	rpt.report(HTML_TPL, output_file=args.outfile, record_list=record_list)
	return rpt.get_result()