持续集成 Jenkins 在 Windows 电脑上无法使用 pytest 是什么原因?

Andy · December 23, 2019 · Last by 阳光下的草 replied at December 23, 2019 · 1904 hits

在 cmd 里面正常使用,在 Jenkins 里面已经配置了 python 环境,可以使用 python,但是无法使用 pytest。需要额外配置 pytest 的环境吗?怎么配置?

共收到 3 条回复 时间 点赞

每次都要 export 下环境变量

在入口 py 文件的顶部加上这段代码试试

import os
import sys
sys.path.append(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0])

pytest -> python -m pytest

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up