我正在尝试使用 GitHub Actions 测试我的包,其中包在 conda
环境中运行。在本地一切正常。但是在 GitHub Actions 上,它说 pytest: command not found
与 this workflow file :
name: Build and Test [Python 3.6, 3.7]
on: push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Miniconda using Python ${{ matrix.python-version }}
uses: goanpeca/setup-miniconda@v1
with:
activate-environment: microdf
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Build
shell: bash -l {0}
run: |
pip install -e .
- name: Run tests
run: |
pytest
我尝试从 conda
环境中删除 pytest
和 instead running pip install pytest
在运行 pytest
之前,但这给出了不同的错误:error: invalid command 'bdist_wheel'
。
最佳答案
您需要指定shell
,如Build
步骤:
- name: Run tests
shell: bash -l {0}
run: pytest
关于python - 从 GitHub Actions 中的 conda 环境运行时找不到 pytest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63593086/