python - 从 GitHub Actions 中的 conda 环境运行时找不到 pytest

标签 python pytest conda github-actions

我正在尝试使用 GitHub Actions 测试我的包,其中包在 conda 环境中运行。在本地一切正常。但是在 GitHub Actions 上,它说 pytest: command not foundthis 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 环境中删除 pytestinstead 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/

相关文章:

python - 如何将元组中的字符串转换为整数?

pytest - 将参数传递给 pytest fixture 以进行拆卸

python - 在没有Conda的情况下从(Conda)environment.yml安装依赖项?

python - pytest(几乎)首先运行新测试

python - 将 Python PuDB 调试器与 pytest 结合使用

docker - 有没有一种方法可以使用conda在Docker镜像中安装库?

macos - osx conda install boost 用 gcc 编译

python - 我在运行 pip install pokitdok 时遇到错误?

python - PyQt5 QWebEngine 禁用 Access-Control-Allow-Origin

python - 在 Python 3.x 中导入时出现问题