[pytest-dev] No traceback filtering with __tracebackhide__ attribute using custom pytest plugin

Bruno Oliveira nicoddemus at gmail.com
Thu Mar 15 18:19:10 EDT 2018

Hi Ringo,

On Tue, Mar 13, 2018 at 6:47 AM Ringo De Smet ringo.de.smet at ontoforce.com
<http://mailto:ringo.de.smet@ontoforce.com> wrote:

> Am I right in saying that the pytest_runtest_makereport hook from
> runner.py is the one calling into the filtering of the traceback and using
> the __tracebackhide__ attribute? Why isn't this done for my custom test
> suite?
You are right, pytest_runtest_makereport creates a longrepr instance
depending on excinfo attribute of the call object[1]:


To do that it calls item.repr_failure(excinfo), which calls _repr_failure_py
in python.py which ends up calling _prunetraceback which filters the
traceback here:


.filter() is declared here:


And the default value uses a lambda where ishidden() checks for
__tracebackhide__ attribute in the function’s locals.

Unfortunately I’m not sure why this does not work with your plugin, but I
hope this gives an overview and helps finding out the problem.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20180315/a60e48f0/attachment.html>

More information about the pytest-dev mailing list