这是我第一次使用Bitbucket管道构建python程序。 我的代码是:
image: python:3.8.11
pipelines:
default:
- step:
name: Install dependencies
script:
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- step:
name: PyTest
script:
- pip install pytest
- pytest -v tests/* --junitxml=test-reports\report.xml
- step:
name: Unit test
script:
- python -m unittest discover tests-reports/
- step:
name: Django test
script:
- pip install django
- python manage.py test
- step:
name: Lint code
script:
# Enforce style consistency across Python projects https://flake8.pycqa.org/en/latest/manpage.html
- pip install flake8
- flake8 . --extend-exclude=dist,build --show-source --statistics
第一步“安装依赖项”通过。但第二步“PyTest”失败了。以下是错误消息:
+ pytest -v tests/* --junitxml=test-reports\report.xml
============================= test session starts ==============================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /opt/atlassian/pipelines/agent/build
collecting ... collected 0 items
- generated xml file: /opt/atlassian/pipelines/agent/build/test-reportsreport.xml -
============================ no tests ran in 0.00s =============================
ERROR: file or directory not found: tests/*
我不确定管道和部署是怎么回事,因为我对这个过程还不熟悉。 有人能告诉我如何解决这个问题吗
从错误中,似乎找不到测试/目录的相对路径。您可以尝试更改构建脚本以使用绝对路径。Bitbucket提供对可用于构建绝对路径的默认variables的访问
你会改变:
类似于以下内容(取决于实际的回购目录结构):
相关问题 更多 >
编程相关推荐