Skip to content

Py.test doesn't show local "caught exception" variables in detailed tracebacks #2919

Answered by nicoddemus
pakal asked this question in General
Discussion options

You must be logged in to vote

@nicoddemus any advice on where this is best fixed?

Hmm unfortunately no, the exception variable is automatically deleted once the stack is unwound to avoid cyclic references...

there's a workaround, which is to assign the exception to a different variable:

        except recurly.errors.NotFoundError as e: 
            if "Account" in e.message:
                error = e
                raise RuntimeError("Abnormal NotFoundError encountered in refresh of user %s" % user)

But I don't know how it could be fixed.

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nicoddemus
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2919 on November 29, 2020 17:20.