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

Support PEP-415's Exception.__suppress_context__ #2632

Merged

Conversation

jmoldow
Copy link
Contributor

@jmoldow jmoldow commented Jul 29, 2017

PEP-415 states that exception.__context__ should be suppressed
in traceback outputs, if exception.__suppress_context__ is
True.

Now if a raise exception from None is caught by pytest,
pytest will no longer chain the context in the test report.

The algorithm in FormattedExcinfo now better matches the one
in traceback.TracebackException.

Exception.__suppress_context__ is available in all of the
versions of Python 3 that are supported by pytest.

Fixes #2631.

PEP-415 states that `exception.__context__` should be suppressed
in traceback outputs, if `exception.__suppress_context__` is
`True`.

Now if a ``raise exception from None`` is caught by pytest,
pytest will no longer chain the context in the test report.

The algorithm in `FormattedExcinfo` now better matches the one
in `traceback.TracebackException`.

`Exception.__suppress_context__` is available in all of the
versions of Python 3 that are supported by pytest.

Fixes pytest-dev#2631.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.887% when pulling 2e61f70 on jmoldow:pep_0415_suppress_exception_context into 768edde on pytest-dev:features.

@nicoddemus
Copy link
Member

Awesome, thanks!

@nicoddemus nicoddemus merged commit 713f763 into pytest-dev:features Jul 30, 2017
@jmoldow jmoldow deleted the pep_0415_suppress_exception_context branch July 30, 2017 22:34
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.

3 participants