[pytest-dev] No traceback filtering with __tracebackhide__ attribute using custom pytest plugin
nicoddemus at gmail.com
Thu Mar 15 18:19:10 EDT 2018
On Tue, Mar 13, 2018 at 6:47 AM Ringo De Smet ringo.de.smet at ontoforce.com
> 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
You are right, pytest_runtest_makereport creates a longrepr instance
depending on excinfo attribute of the call object:
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
.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...
More information about the pytest-dev