PyO3 / PyO3/pyo3

Expand test coverage for FFI compat shims

Open
#5,969 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

FFI
Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

The test coverage in our FFI compat shims is poor:

https://app.codecov.io/github/pyo3/pyo3/tree/main/pyo3-ffi%2Fsrc%2Fcompat

At time of writing, coverage for pyo3-ffi/compat is at 67%.

There's a chance of subtle breakage that only happens on older Python versions. It also adds friction to adding new compat shims because there's no infrastructure for adding tests and no clear way of making the coverage CI checks pass.

See https://github.com/PyO3/pyo3/pull/5955#issuecomment-4195082762 for a concrete time this caused friction for a contribution.

The pythoncapi-compat repository has extensive tests for its compat shims which we can probably crib off of:

https://github.com/python/pythoncapi-compat/blob/main/tests/test_pythoncapi_compat_cext.c

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

Inspect the existing compat shims under pyo3-ffi/compat and the linked pythoncapi-compat test file, tests/test_pythoncapi_compat_cext.c. Start by understanding how older Python versions are covered and how the current coverage check is run. Done means the shims have meaningful tests, older-version breakage is exercised, and the coverage CI checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
backend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.