Azure 管道退出并显示此错误 ##[错误]Bash 退出并显示代码“5”。对于 python 存储库

问题描述 投票:0回答:1

我按照 https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/python?view=azure-devops#3-customize-your-pipeline 创建了一个 azure 管道

我使用了官方链接中提到的相同脚本,如下所示

  - script: |
      pip install pytest pytest-azurepipelines
      pytest
    displayName: 'pytest'

在此输入图片描述

运行我的 python 脚本、构建和发布工件后,管道在此步骤失败并出现以下错误。

*Error:*
**
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/vsts/work/1/s
plugins: anyio-4.4.0, azurepipelines-1.0.5, nunit-1.0.7
collected 0 items
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
No Result Found to Publish '/home/vsts/work/1/s/test-output.xml'.
Skipping uploading of coverage data.

-------- generated Nunit xml file: /home/vsts/work/1/s/test-output.xml ---------
============================ no tests ran in 0.01s =============================

##[error]Bash exited with code '5'.
Async Command Start: Publish test results
Async Command End: Publish test results
Finishing: pytest**

在此输入图片描述

你能帮我解决问题吗?

  - script: |
      pip install pytest pytest-azurepipelines
      pytest
    displayName: 'pytest'
python-3.x azure-devops azure-pipelines azure-pipelines-yaml azure-python-sdk
1个回答
0
投票

我的管道运行

pytest
,并使用在文档中共享的存储库中的示例代码,正在按预期工作。

Image

只有当我从我的存储库中删除

test*.py

 时,我才能重现该问题。

Image

Image

请注意在源代码中仔细检查这一点。

© www.soinside.com 2019 - 2024. All rights reserved.