新手区 使用 pathlib 来获取路径,python 直接运行能正确获取路径,但是用 jenkins 时,总提示找不到对应路径的文件

小本淡淡 · 2017年10月09日 · 1602 次阅读

写了个 python 脚本想集成到 jenkin 中看效果,但是路径获取一直失败,路径使用的是 pathlib 模块,python 直接运行是正常的。代码如下
python 脚本

import pytest
from pathlib import Path

suite_path = Path(__file__).parent.parent / "testcase" / "base"
report_path = Path(__file__).parent.parent / "report" / "report.html"
print(suite_path)
print(report_path)
pytest.main(args=[f"--html={str(report_path)}", str(suite_path)])

jenkins 配置

提示的错误如下

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册