Hi Ringo,

On Tue, Mar 13, 2018 at 6:47 AM Ringo De Smet ringo.de.s...@ontoforce.com
<http://mailto:ringo.de.s...@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]:

https://github.com/pytest-dev/pytest/blob/fbcf1a90c9ffa849827918249fef1721a1f43bdd/_pytest/runner.py#L294-L307

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:

https://github.com/pytest-dev/pytest/blob/fbcf1a90c9ffa849827918249fef1721a1f43bdd/_pytest/python.py#L578

.filter() is declared here:

https://github.com/pytest-dev/pytest/blob/fbcf1a90c9ffa849827918249fef1721a1f43bdd/_pytest/_code/code.py#L307

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.

Cheers,
Bruno.
​
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to