python - 从 GitHub Actions 中的 conda 环境运行时找不到 pytest
问题描述
我正在尝试使用 GitHub Actions 测试我的包,该包在conda
环境中运行。在本地一切正常。但是在 GitHub Actions 上,它pytest: command not found
用这个工作流文件说:
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
我尝试pytest
从conda
环境中删除,而是在运行 pip install pytest
之前运行pytest
,但这给出了不同的错误:error: invalid command 'bdist_wheel'
.
解决方案
您需要指定shell
,如Build
步骤中所示:
- name: Run tests
shell: bash -l {0}
run: pytest
推荐阅读
- jquery - 用 Jest 模拟 ajax 调用
- r - 数据帧中周期的开始和结束
- express - 我怎么能没有。在 expressjs 应用程序的 git commit 中添加、删除和修改的行和注释?
- c# - 将填充了包含 DataVisualization.Charting 图表的 WindowsFormsHost 的网格保存到图像
- mysql - mysql 问题:如何在 where 语句中选择和转换?
- java - Okta 客户端凭据访问令牌问题
- android - java.lang.IllegalStateException:无法分析:java.lang.reflect.InvocationTargetException
- javascript - 如何在fullcalendar v5的eventConten中获取元素并将其分配给tip?
- reactjs - Firebase 游戏,每个玩家都有一个目标
- xcode - 安装旧版本的 Xcode 命令行工具