【发布时间】:2021-11-17 00:01:05
【问题描述】:
1.目前,我正在构建一个烧瓶项目,并且我还编写了一些单元测试代码。现在我想在 GitHub 操作上运行单元测试,但它卡在 ./run 阶段(./run 将打开http://127.0.0.1:5000/),并且没有运行 $pytest 命令。我知道 $pytest 不会执行的原因是因为 Github Action 正在运行端口http://127.0.0.1:5000/。在这种情况下,它无法执行./run 之后的任何命令。我想知道我可以在 GitHub 操作中的另一个终端上运行 $pytest 吗?这可能吗?
这是我的 github 操作的输出:
Run cd Flask-backend
cd Flask-backend
./run
pytest
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.8.10/x64
* Serving Flask app 'app.py' (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 404-425-256
2.这是我的 yml 文件代码:
name: UnitTesting
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Python 3
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirement.txt
- name: Run tests with pytest
run: |
cd Flask-backend
./run
pytest
【问题讨论】:
标签: flask github github-actions