Support for Gcov coverage in extensions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
I have a Python package with a Pybind11 extension and I'd like to create coverage reports for both the Python and the C++ code. I can do this by doing the following running:
CFLAGS="-coverage" python setup.py build_ext --inplace
coverage run -m pytest ...
find src -type f -name '*.cpp' | xargs -I{} gcov -o build/temp*/src {}
This works because -coverage adds .gcno files in the build directory, which coverage recognizes and creates .gcda files. Finally gcov is used to create gcov files.
Describe the solution you'd like
Instead of using old not recommended python setup.py, I'd rather do something like:
CFLAGS="-coverage" pip install -e .
and have setup.cfg with:
[build_ext]
inplace=1
be enough to get a build directory with .gcno in it.
Alternative Solutions
Yes with old python setup.py
Additional context
Obviously this assumes gcov is installed on the system.
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the editable-install flow using CFLAGS="-coverage" pip install -e ., and compare it with the setup.py build_ext --inplace command in the issue. Inspect setup.cfg, including its [build_ext] section, and verify that the resulting build directory contains .gcno files for the extension. Done means gcov coverage artifacts can be produced without invoking setup.py directly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100