Description
Originally reported by: BitBucket: pchambon, GitHub: pchambon
Hello,
I've just spent a hell of a time trying to debug a "Recursion detected (same locals & position)" that my test suite raised, to eventually see that it was not a python error, but a pytest problem while collecting test results.
Due to the "magic" used in the program (decorator module), pytest thought there was a recursion, whereas several functions were simply using generated wrappers to preserve their signature while decorating.
The main problem is actually that the real exception (a runtime error, in the test sample) got hidden because of that "recursion detected" (see output below), thus deceiving me about the real problem. Having a fix to ignore "" entries, when detecting traceback recursions, would be neat too.
CF attached sample to reproduce the error ("decorator" module must tbe installed).
cheers,
P. Chambon
#!python
[pascal@charlie ~/test]$ py.test weird_recursion.py
====================================== test session starts =======================================
platform freebsd8 -- Python 2.6.6 -- pytest-2.0.3
collected 0 items / 1 errors
============================================= ERRORS =============================================
______________________________ ERROR collecting weird_recursion.py _______________________________
weird_recursion.py:32: in <module>
> test_tolkien_weird_recursivity()
weird_recursion.py:29: in test_tolkien_weird_recursivity
> retrieve_stuffs("0654345654123")
<string>:2: in retrieve_stuffs
> ???
weird_recursion.py:11: in mymiddleware
> res = func(*args, **kwargs)
<string>:2: in retrieve_stuffs
> ???
!!! Recursion detected (same locals & position)
---------------------------------------- Captured stderr -----------------------------------------
NOW WE RAISE ERROR
==================================== 1 error in 0.15 seconds =====================================