pytest segfault, not with -v

Barry barry at barrys-emacs.org
Sun Nov 21 08:30:30 EST 2021


I would run the whole set of tests under gdb and wait for the segv to happen.
You may find that an isolated test will pass. Sometimes it is a sequence of test
and lead to the segv.

Barry

> On 19 Nov 2021, at 23:48, Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
> 
> On Fri, 19 Nov 2021 at 20:38, MRAB <python at mrabarnett.plus.com> wrote:
>> 
>>> On 2021-11-19 17:48, Marco Sulla wrote:
>>> I have a battery of tests done with pytest. My tests break with a
>>> segfault if I run them normally. If I run them using pytest -v, the
>>> segfault does not happen.
>>> 
>>> What could cause this quantical phenomenon?
>>> 
>> Are you testing an extension that you're compiling? That kind of problem
>> can occur if there's an uninitialised variable or incorrect reference
>> counting (Py_INCREF/Py_DECREF).
> 
> Ok, I know. But why can't it be reproduced if I do pytest -v? This way
> I don't know which test fails.
> Furthermore I noticed that if I remove the __pycache__ dir of tests,
> pytest does not crash, until I re-ran it with the __pycache__ dir
> present.
> This way is very hard for me to understand what caused the segfault.
> I'm starting to think pytest is not good for testing C extensions.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list