Linux 求助:在 linux 搭建的 jenkins 执行提示 pytest: error: unrecognized arguments: --html=report.html

皆非 · June 20, 2019 · Last by 皆非 replied at June 21, 2019 · 2269 hits
系统环境
ubunt18.04
python3.6
pytest-html        1.21.1
求助
测试脚本生成报告

在jenkins Execute shell 执行命令 pytest --html=report.html 提示  

pytest: error: unrecognized arguments: --html=report.html

用终端同样的命令执行就不会报错,这个是为啥哦?是不是这个 --h 被转义了?

注: jenkins 执行权限已经配置成root,  在终端和jenkins执行的命令都是  pytest --html=report.html 

根本原因找到了,linux 里默认装了两个版本的 python, python2 和 python3.6,而我自己又装了 python3.7,在终端执行是 py37,在 jenkins 执行是 py36

共收到 2 条回复 时间 点赞

猜:

  1. pytest-html 装到 python2 里去了
  2. pytest-html 装到 python3, 但 pytest 装到 python2

解:
python3 -m pip install pytest pytest-html
python3 -m pytest --html=report.html

皆非 #2 · June 21, 2019 Author

我试了下,不是这个问题, 在终端执行命令 pytest --html=report.html 没问题,在 jenkins 执行就报这个错误

皆非 关闭了讨论 21 Jun 11:18
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up