[TIP] pytest-cov: Sanitize file paths

Daniel Knüttel daniel.knuettel at daknuett.eu
Fri Dec 20 05:15:32 PST 2019


Hi folks,

I use pytest-cov to generate coverage reports that I want to upload to
codacy to analyze them there. As I have to build and install the module
first, pytest-cov puts the path of the installed module in front of the
actual file path:

/home/daniel/.envs/pyqcs/lib/python3.7/site-packages/pyqcs-1.1.2-py3.7-linux-x86_64.egg/pyqcs/__init__.py

Codacy rejects those coverage reports, as it cannot match the file
paths. Is there a way to tell pytest-cov to sanitize the output, i.e.
use just pyqcs/__init__.py?

Cheers,
Daniel

PS: I didn't find a way to test for memory leaks in C extensions yet.

-- 
Daniel Knüttel <daniel.knuettel at daknuett.eu>




More information about the testing-in-python mailing list