pyodide / pyodide/pytest-pyodide

Use of pytest-cov in subworkflow fails

Open
#181 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38
Forks
20
Avg merge
1d 23h
Merged PRs (30d)
1

Description

I'm following the instructions in the readme. This is my workflow definition which uses your main workflow as instructed.

name: Pyodide

on:
  workflow_dispatch: {}
  workflow_call: {}

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: ["3.12"]

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install pyodide
        run: |
          python -m pip install --upgrade pip setuptools wheel
          python -m pip install pyodide-build>=0.27
          echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV

      - name: Install Emscripten
        uses: mymindstorm/setup-emsdk@v14
        with:
          version: ${{ env.EMSCRIPTEN_VERSION }}

      - name: Build pyodide package
        run: pyodide build

      - name: Upload pyodide wheel
        uses: actions/upload-artifact@v4
        with:
          name: pyodide_wheel
          path: dist

  test:
    needs: build
    uses: pyodide/pytest-pyodide/.github/workflows/main.yaml@main
    with:
      build-artifact-name: pyodide_wheel
      build-artifact-path: dist
      browser: firefox
      runner: selenium
      pyodide-version: 0.27.2

When I run action, I hit an error because the --cov argument for pytest is not recognized. You can see the error here https://github.com/Midnighter/httpx-limiter/actions/runs/20825384915/job/59825311877?pr=12#step:12:20

I'm thinking that this is because I'm hitting the condition that only installs pytest-pyodide (here). So that path should probably also install pytest-cov.

However, I'm failing to see why you would always check coverage of pytest_pyodide as defined in this line. I can't see anyone caring about that when they run your workflow on their own package. Or am I missing something here?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/workflows/main.yaml around lines 119 and 125, then reproduce the README workflow using the linked example. Trace when pytest-cov is installed and why --cov targets pytest_pyodide; done means the subworkflow no longer fails for a caller package and its coverage behavior is clearly appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.