Skip to content

Use of pytest-cov in subworkflow fails #181

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions