Skip to content

Use of pytest-cov in subworkflow fails #181

Open

Description

@Midnighter

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?

Activity

  1. Midnighter commented on Jan 8, 2026

    @Midnighter
    Author

    I copied your workflow definition, removed --cov argument and now it runs fine.

  2. ryanking13 commented on Jan 9, 2026

    @ryanking13
    Member

    Good catch, thanks. Yes, pytest-cov is used only for testing the coverage for this package.

    The root issue is that the main.yaml file is used for testing pytest-pyodide itself and also mentioned in our README so that it can be used in downstream repositories that want to use pytest-pyodide. I think we should separate that.

  3. Midnighter commented on Nov 7, 2026

    @Midnighter
    Author

    Hi again,

    I was wondering if there is an intention to provide a reusable workflow for users of pytest-pyodide? I recently updated my own, but I'd love a solution that ensures that my workflow stays up-to-date with pyodide.

  4. ryanking13 commented on Nov 9, 2026

    @ryanking13
    Member

    Perhaps yes. To be honest, I previously felt that maintaining subworkflows for external users within the pytest-pyodide repository created an unnecessary maintenance burden. However, in this era of AI agents, perhaps we could leverage an agent to devise a cleaner, more manageable approach.

  5. Midnighter commented on Nov 9, 2026

    @Midnighter
    Author

    I can very well empathize with that sentiment. I'd appreciate having a canonical example, at least. As an example, it seems no longer necessary to have a separate emscripten step, as that is now bundled. Keeping abreast of such changes is rather difficult from a distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions