-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Correctly handle tracebackhide for chained exceptions #10772
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
Merged
nicoddemus
merged 8 commits into
pytest-dev:main
from
Felhof:issue_1904_tracebackhide_does_not_work_with_chained_exceptions
Mar 15, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a583c68
Correctly handle tracebackhide for chained exceptions
Felhof 377ef7f
fix test that was assuming wrong return value for getcrashentry
Felhof 8404419
update changelog and Authors file
Felhof 1765f99
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 332cb13
Add documentation to test for tracebackhide
Felhof e6e36c2
reformat docstring to conform to linting rules
Felhof 7f95c9c
add checks to make sure crash entries are not none where they should …
Felhof 7b5bc36
allow reprcrash to be none in ReprExceptionInfo
Felhof File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Correctly handle ``__tracebackhide__`` for chained exceptions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
def test_tbh_chained(testdir): | ||
"""Ensure chained exceptions whose frames contain "__tracebackhide__" are not shown (#1904).""" | ||
p = testdir.makepyfile( | ||
""" | ||
import pytest | ||
|
||
def f1(): | ||
__tracebackhide__ = True | ||
try: | ||
return f1.meh | ||
except AttributeError: | ||
pytest.fail("fail") | ||
|
||
@pytest.fixture | ||
def fix(): | ||
f1() | ||
|
||
|
||
def test(fix): | ||
pass | ||
""" | ||
) | ||
result = testdir.runpytest(str(p)) | ||
assert "'function' object has no attribute 'meh'" not in result.stdout.str() | ||
assert result.ret == 1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.