[TIP] Debugging C Extensions with PyTest : Memory Checking

Marius Gedminas marius at gedmin.as
Tue Nov 12 09:15:56 PST 2019


On Tue, Nov 12, 2019 at 05:33:05PM +0100, Daniel Knüttel wrote:
> Is there a way to include memory checking for C extensions in pytest
> tests?

That is an interesting question and I'd love to hear the answer.

> Basically what I usually do is to write a small file that calls the
> stuff I want to test and then run
> 
>     valgrind python3 do_stuff.py
> 
> but this is (a) not integrated into my systematic tests and (b) always
> gives a shitload of errors because apparently no python developer heard
> of a memory checker before.

They have, and they even provide a Valgrind suppresion file for your
convenience:

- https://github.com/python/cpython/blob/master/Misc/README.valgrind
- https://github.com/python/cpython/blob/master/Misc/valgrind-python.supp

Regards,
Marius Gedminas
-- 
The reason computer chips are so small is that computers don't eat much.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20191112/7060f1b9/attachment.pgp>


More information about the testing-in-python mailing list