Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Add unraisableexception and threadexception plugins #8055
Conversation
If the user passed stdin=PIPE for some reason, they have no way to close it themselves since it is not exposed.
|
Awesome work @bluetech! |
| because they don't cause the program itself to crash. Pytest detects these | ||
| conditions and issues a warning that is visible in the test run summary. | ||
|
|
||
| The modules are automatically enabled for pytest runs, unless the |
nicoddemus
Nov 21, 2020
Member
Did you mean?
Suggested change
The modules are automatically enabled for pytest runs, unless the
The warnings are automatically enabled for pytest runs, unless the
Did you mean?
| The modules are automatically enabled for pytest runs, unless the | |
| The warnings are automatically enabled for pytest runs, unless the |
bluetech
Nov 21, 2020
Author
Member
I copy the phrasing from the faulthandler section just above this one, but I agree it's not great. I don't think we should use "warnings" here because enabling warnings is a separate thing. I'll change this to "plugins".
I copy the phrasing from the faulthandler section just above this one, but I agree it's not great. I don't think we should use "warnings" here because enabling warnings is a separate thing. I'll change this to "plugins".
| @@ -470,6 +470,38 @@ seconds to finish (not available on Windows). | |||
| the command-line using ``-o faulthandler_timeout=X``. | |||
|
|
|||
|
|
|||
| .. _unraisable: | |||
|
|
|||
| Warning about unraisable exceptions and unhandled thread exceptions | |||
nicoddemus
Nov 21, 2020
Member
Great docs!
Great docs!
| def unraisable_exception_runtest_hook() -> Generator[None, None, None]: | ||
| with catch_unraisable_exception() as cm: | ||
| yield | ||
| if cm.unraisable: |
RonnyPfannschmidt
Nov 21, 2020
Member
would it be sensible to move this into the context manager, then the yield from generator hack wouldn't have to be used
would it be sensible to move this into the context manager, then the yield from generator hack wouldn't have to be used
bluetech
Nov 21, 2020
Author
Member
I prefer to keep the context manager itself standalone from pytest stuff just in case it's useful on its own.
I prefer to keep the context manager itself standalone from pytest stuff just in case it's useful on its own.
|
There seems to be quite some code duplication between the two plugins - do they really need to be separate? I think I'd prefer having them in one plugin and sharing more code. |
The certainly look similar, but the similarity is just structural, not logical. IMO it would be wrong to couple them -- they couldn't be disabled separately, and I suspect will cause maintainability issues if new requirements ever come up, a process which is nicely described in this article and is pretty accurate from my experience. |
Fixes #5299.
Please see the added documentation for details. The first two commits just fix a couple of issues this found in our own testsuite.
While the two plugins are very similar, I chose to keep them separate because I think it's cleaner and so they may be disabled separately.
Performance-wise this adds about 3% to the pure pytest overhead, which seems fine.