Airtest icon indicating copy to clipboard operation
Airtest copied to clipboard

引用了其他模块的用例脚本用LogToHtml导出报告报错FileNotFoundError: [Errno 2] No such file or directory:

Open IndigoMagic opened this issue 3 years ago • 0 comments

:bulb:相关项目: Airtest

标题: [BUG提交]引用了其他模块的用例脚本用LogToHtml导出报告报错FileNotFoundError: [Errno 2] No such file or directory:

AirtestIDE版本:

  • [x] 使用了本地Pyhton环境运行脚本
  • Python版本: 3.8.3
  • Airtest版本: v1.2.4

报错描述:     引用了其他模块的用例脚本用LogToHtml导出报告报错FileNotFoundError: [Errno 2] No such file or directory: ,要把被引用的模块使用的静态文件都拷到用例脚本的同级目录,才能成功导出报告

相关截图:

报错Log:

src = 'C:/Users/haha/script/pomdemo1/pomdemo/tools/business_tools\\into_szmd_pics/工作台.png'
dst = 'C:/Users/haha/script/pomdemo1/pomdemo/report/air_report\\test_store_list.log\\into_szmd_pics/工作台.png'

    def copyfile(src, dst, *, follow_symlinks=True):
        """Copy data from src to dst in the most efficient way possible.
    
        If follow_symlinks is not set and src is a symbolic link, a new
        symlink will be created instead of copying the file it points to.
    
        """
        sys.audit("shutil.copyfile", src, dst)
    
        if _samefile(src, dst):
            raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
    
        file_size = 0
        for i, fn in enumerate([src, dst]):
            try:
                st = _stat(fn)
            except OSError:
                # File most likely does not exist
                pass
            else:
                # XXX What about other special files? (sockets, devices...)
                if stat.S_ISFIFO(st.st_mode):
                    fn = fn.path if isinstance(fn, os.DirEntry) else fn
                    raise SpecialFileError("`%s` is a named pipe" % fn)
                if _WINDOWS and i == 0:
                    file_size = st.st_size
    
        if not follow_symlinks and _islink(src):
            os.symlink(os.readlink(src), dst)
        else:
>           with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
E           FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/haha/script/pomdemo1/pomdemo/report/air_report\\test_store_list.log\\into_szmd_pics/工作台.png'

连接设备信息:

设备类型 设备型号 系统版本号 apk名称/下载链接 使用的wda版本 wda更新到最新
iOS iPhone12mini 15.2 Appium/WebDriverAgent

提供最小可复现此BUG的代码:

IndigoMagic avatar Jan 14 '22 08:01 IndigoMagic