Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter selectively with __tracebackhide__ #1526

Merged
merged 4 commits into from Apr 20, 2016

Conversation

Projects
None yet
3 participants
@The-Compiler
Copy link
Member

The-Compiler commented Apr 20, 2016

When __tracebackhide__ gets set to an exception type or list/tuple of exception types, only those exceptions get filtered, while the full traceback is shown if another exception (e.g. a bug in a assertion helper) happens.

The-Compiler added some commits Apr 20, 2016

Filter selectively with __tracebackhide__
When __tracebackhide__ gets set to an exception type or list/tuple of
exception types, only those exceptions get filtered, while the full
traceback is shown if another exception (e.g. a bug in a assertion
helper) happens.
@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented Apr 20, 2016

i would suggest to support callables instead that get the exception info as parameter

then we could have __tracebackhide__ = methodcaller('errisinstance', ValueError)

Use a callable __tracebackhide__ for filtering
While this leads to slightly more complicated user code for the common
case (checking if the exception is of a given type) it's easier to
implement and more flexible.
@The-Compiler

This comment has been minimized.

Copy link
Member Author

The-Compiler commented Apr 20, 2016

I like that idea, more flexible and simpler to implement - updated!

Use py.builtin.callable
This restores compatibility with Python 3.0/3.1

@RonnyPfannschmidt RonnyPfannschmidt merged commit b220c96 into pytest-dev:features Apr 20, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nicoddemus

This comment has been minimized.

Copy link
Member

nicoddemus commented Apr 20, 2016

Nice work! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.