【问题标题】:jenkins pipeline virtualenv plugin withPythonEnv詹金斯管道虚拟环境插件与PythonEnv
【发布时间】:2018-07-05 13:40:49
【问题描述】:

在我的自定义 jenkins 管道上,(之前安装了管道 virtualenv 插件)我尝试了这样的代码:

withPythonEnv('python3.5') {
     pysh 'pytest --cucumberjson=result.json testscript.py'
}

但它在管道的控制台输出中看起来仍然是针对 Python2.7 平台:

pytest --cucumberjson=result.json testscript.py

============== 测试会话开始 ================

平台 linux2 -- Python 2.7.13、pytest-3.6.3、py-1.5.4、pluggy-0.6.0

另一方面,我在 pycharm 中使用 Python3.5 的 venv 运行相同的 py.test:

平台 linux -- Python 3.5.3、pytest-3.6.2、py-1.5.3、pluggy-0.6.0

有什么建议吗?

提前致谢, 问候

【问题讨论】:

  • 大家好,我是pyenv-pipeline-plugin的创建者。我最近发布了一个新版本,希望你能尝试一下,看看它是否能解决你的问题。否则,请在 Github 项目中打开一个 issue:github.com/jenkinsci/pyenv-pipeline-plugin
  • @BenKalender 我想我仍然有同样的问题。你有什么更新吗?

标签: python jenkins virtualenv pyenv


【解决方案1】:

这也让我很困惑。看起来 pyenv 管道插件不理解 pyenv 别名/名称,但它可以理解环境的路径。在您的情况下,如果假设您的环境安装在/root/.pyenv/versions/3.5.3/envs/myenv_3_5_3,这应该可以工作:

withPythonEnv('/root/.pyenv/versions/3.5.3/envs/myenv_3_5_3/bin/python') {
   pysh 'pytest --cucumberjson=result.json testscript.py'
}

【讨论】:

    猜你喜欢
    • 2019-02-27
    • 1970-01-01
    • 2017-03-05
    • 1970-01-01
    • 2019-01-09
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多