Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable PyTest Recursion Checking?

When I run PyTest, I get some tests failing with

....
!!! Recursion detected (same locals & position)

However when I run the tests manually, I see that there is no infinite recursion. My code does do some weird stuff that probably trick's pytest's recursion detector.

Is there a way to disable recursion checking for certain tests?

I'm running PyTest 3.0.1

like image 412
Peter Avatar asked Mar 02 '26 06:03

Peter


1 Answers

If you are setting return_value on a mocked function that is referenced by your recursive code, use side_effect instead.

like image 78
mixja Avatar answered Mar 04 '26 00:03

mixja



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!