jenkins+pytest+allure+python ModuleNotFoundError: No module named 'pytest'

 

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'
当程序在本地可以运行并可生成报告,但是在jenkins里面提示找不到pytest库之类的,这种情况多半是pycharm工具第三方插件安装在默认的路径中,没有跟python环境的路径一致。所以jenkins找不到,本地pycharm可以找到。需要手动去pytest库(删除整个路径),删除后,在cmd中使用命令安装,安装的同时可以看到路径跟python的安装路径是一致的。
手动安装命令:
pip install pytest-html  自动生成 HTML 格式测试报告
pip install pytest-describe  给测试用例一个美丽的名字
pip install pytest-autochecklog(不只是自动生成测试日志)
pip install sugar  测试进度可视化
pip install ordering  改变测试用例的顺序
pip install allure-pytest (生成 allure报告)


posted @   GoodMorning9527  阅读(774)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示