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
Merged

Filter selectively with __tracebackhide__ #1526

merged 4 commits into from
Apr 20, 2016

Conversation

The-Compiler
Copy link
Member

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.

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
Copy link
Member

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

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

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
Copy link
Member Author

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

This restores compatibility with Python 3.0/3.1
@RonnyPfannschmidt RonnyPfannschmidt merged commit b220c96 into pytest-dev:features Apr 20, 2016
@nicoddemus
Copy link
Member

Nice work! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants