Modern Python CI with Coverage in 2025

(danielnouri.org)

3 points | by dnouri 7 hours ago

1 comments

  • dnouri 7 hours ago
    I covered a gap by blogging about: Modern Python CI with Coverage in #2025

    Let me know in the comments if you think it's useful.

    From the table of contents:

        Our toolchain
            py-cov-action: GitHub-native coverage
                The two-workflow pattern for fork PRs
            pytest-xdist: Parallel testing by default
            uv: Fast package management
        Six critical gotchas
            Gotcha #1: Using coverage run -m pytest with xdist
            Gotcha #2: Missing relative_files = true
            Gotcha #3: Hidden files excluded from artifacts
            Gotcha #4: Fork PRs can't post comments
            Gotcha #5: Missing pytest-cov plugin
            Gotcha #6: E2E tests with subprocesses contribute 0% coverage
        Complete working example
            .github/workflows/ci.yml
            .github/workflows/post-coverage-comment.yml
            pyproject.toml configuration
        Verifying your setup
            Check relative paths
            Verify artifact upload
            Test fork PR comments
            What success looks like
        Migration notes
            From Codecov/Coveralls
            From pip to uv
        Next steps
        Resources