【发布时间】:2020-10-24 14:13:51
【问题描述】:
我正在关注 python/flask/docker tutorial 。一切都很完美,直到我推到 GitLab 管道阶段构建良好然后在测试阶段失败:
stage: test
image: $IMAGE:latest
services:
- postgres:latest
variables:
POSTGRES_DB: users
POSTGRES_USER: runner
POSTGRES_PASSWORD: runner
DATABASE_TEST_URL: postgres://runner:runner@postgres:5432/users
script:
- python3.8 -m venv env
- source env/bin/activate
- pip install -r requirements.txt
- pip install black flake8 isort pytest
- pytest "project/tests" -p no:warnings
- flake8 project
- black project --check
- isort project/**/*.py --check-only
管道测试日志:
$ pytest "project/tests" -p no:warnings
============================= test session starts ==============================
platform linux -- Python 3.8.1, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
rootdir: /builds/piccoloa/flask-on-docker/project/tests, configfile: pytest.ini
collected 30 items
project/tests/test_config.py ... [ 10%]
project/tests/test_ping.py . [ 13%]
project/tests/test_users.py ............. [ 56%]
project/tests/test_users_unit.py ............. [100%]
============================== 30 passed in 0.41s ==============================
$ flake8 project
$ black project --check
would reformat /builds/piccoloa/flask-on-docker/project/api/users.py
would reformat /builds/piccoloa/flask-on-docker/project/tests/test_users.py
would reformat /builds/piccoloa/flask-on-docker/project/tests/test_users_unit.py
Oh no! ???? ???? ????
3 files would be reformatted, 10 files would be left unchanged.
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
找到了这个,但不知道如何解决或者它是否与问题有关。 GitLab Issue 中提到的“调整阈值或提高覆盖率”。我在 localhost 上运行测试时没有收到任何错误?
【问题讨论】:
标签: gitlab testdriven.io