Search code examples
pythonfilterpyteststack-tracetraceback

py.test Tracebacks: Highlight my code, fold frames of framework


Tracebacks of my tests are too long since I use pytest.

Pytests includes surrounding code lines and a lot of other information.

I like to see this information if the traceback line (frame) is from my code. But I don't want to see it, if it is from a library or framework.

I could not find a way to filter or fold the frames.

Any hints?

Update, 8 years later: I think it is time to say goodbye to ASCII and embrace html. With html you can expand/collapse parts (like in the great django debug view).

Unfortunately there seems to be no pytest output which gives you nice interface like for example sentry does.


Solution

  • I'm afraid this is currently not possible and is an enhancement request: https://bitbucket.org/hpk42/pytest/issue/283/traceback-filtering-hook

    The only control you have for the moment is --tb=short etc.