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.
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
threadexception enhancements #13016
threadexception enhancements #13016
Changes from 8 commits
e44969c
2615916
c24c03e
f1195c3
ee5cb32
d2377b5
ec782db
bf770cf
82f60d6
4efa96a
9e26040
faf769c
7a56153
6224f17
8af4991
4b95be7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the bit of the PR I'm most unsure about. I think maybe we want to raise a deprecation warning for straggling threads - and make it into a error in pytest 9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a reasonable thing for someone to run some thread unrelated to pytest, like a monitoring thread or similar (there are many which do this), and then run
pytest.main()
. If I understand correctly, this would then cause an unnecessary 1s delay to the pytest run. Best case, they report a bug, worst case they just think pytest is slow and suffer through it.So IMO, unless we can somehow restrict
join_threads
only to threads started by tests, we shouldn't do it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in #13027
Check warning on line 41 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L41
Check warning on line 71 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L68-L71
Check warning on line 76 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L73-L76
Check warning on line 82 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L80-L82
Check warning on line 85 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L85
Check warning on line 87 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is absolutely definitely covered by tests:
pytest/testing/test_threadexception.py
Lines 136 to 162 in 7a56153
what's going on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved, yeah? Looks like 100% coverage wherever I look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, in the review window codecov is being dumb. idk what exactly triggers it but the codecov app/bot/thing is fairly often behind (not just in this repo), and the CI run is the best place to go look for coverage status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI refers to https://github.com/pytest-dev/pytest/pull/13016/checks?check_run_id=33901516563, but the "Files Changed" codecov alerts refers to https://github.com/pytest-dev/pytest/pull/13016/checks?check_run_id=33900516688 - which while on the same commit it displays an orange "refresh" button that will redirect to 33901516563. Not sure how those runs differ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think this is due to
as seen on https://docs.codecov.com/docs/github-checks
Which I think means we (and every project) needs to disable annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened codecov/codecov-action#1710 requesting the default be changed, but will otherwise open PR's/edit the org-level yaml to disable them.
Check warning on line 114 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L111-L114
Check warning on line 123 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L121-L123
Check warning on line 125 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L125
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stale/misplaced comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is valid, I meant compute the strings in the hook rather than later on in the collect-from-deque phase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the comment to the correct place. And I've gone through and checked the comments match the unraisablehook (or diverge where changes are needed)
Note the first commit in this PR was generated by claude - given the unraisablehook patch and the existing threadexception.py. It did well on the code but not so well on the comments!
Check warning on line 135 in src/_pytest/threadexception.py
Codecov / codecov/patch
src/_pytest/threadexception.py#L133-L135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we wait for this? Or open an issue to track it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think open an issue to track this, the unraisablehook code has the same issue