在我的Azure DevOps管道中。
(https://dev.azure.com/TheNewThinkTank/_git/dark-matter-attractor)。
Pytest的安装和运行方式遵循官方的Microsoft文档。
(https://dev.azure.com/TheNewThinkTank/dark-matter-attractor/_build?definitionId=2&_a=summary)
我有一个测试阶段,希望在对应的Azure DevOps存储库中的所有Python文件上安装并运行pytest。(https://dev.azure.com/TheNewThinkTank/_git/dark-matter-attractor)。
Pytest的安装和运行方式遵循官方的Microsoft文档。
- script: |
pip install pytest
pip install pytest-cov
pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html
displayName: 'Test with pytest'
此链接可找到:https://learn.microsoft.com/zh-cn/azure/devops/pipelines/ecosystems/python?view=azure-devops
运行管道会导致在上述步骤出现错误:pytest: command not found
如果您想查看完整的回溯信息:
我尝试过的其他方法:
按照官方 pytest 网站(https://docs.pytest.org/en/stable/getting-started.html)的指引,我尝试在安装命令中添加一个标志:pip install -U pytest
,但结果相同。
是什么阻止了 Pipeline 发现已安装的 pytest 模块?