Replies: 1 comment
-
Hey,
How are you doing that? I ask because pytest will filter out any traceback frame which contains a local variable
I would probably parse each file name out of each stack frame, trying to somehow find out the module to which the frame belongs to, and then decide it based on a block/allow list (for example |
Beta Was this translation helpful? Give feedback.
-
I am developing a Jupyter Widget that uses traitlets. My stack traces are occasionally huge (over 300 lines). I want to present the users of my widget with much more compact stacktraces only related to pieces that they control. I want to test that I'm properly filtering and limiting the stacktraces. I'm running into a couple problems trying to test this behaviour. Where should I look for inspiration?
I want to test that certain functions never end up in a traceback.
At this point I'm just asserting that the length of the traceback is less than what I'd get without the re-raising stuff i'm trying to test.
My tests look like this
I made a small example notebook showing the stacktraces I don't want and the cleaned up ones
https://gist.github.com/paddymul/acffe2a902db7ad2cee1a7c223be7f88
Beta Was this translation helpful? Give feedback.
All reactions