bpo-36829: Document test.support.catch_unraisable_exception()#13554
bpo-36829: Document test.support.catch_unraisable_exception()#13554vstinner merged 1 commit intopython:masterfrom vstinner:catch_unraisable2
Conversation
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Might be worth suggesting gc.collect()
There was a problem hiding this comment.
gc.collect() is not needed. Why do you want to force a GC collection?
There was a problem hiding this comment.
It's not needed but it's often a good trigger of these sort of exceptions
There was a problem hiding this comment.
Well, tests using the context manager expect an unraisable exception and fail if it's not the case.
There was a problem hiding this comment.
Oh. By the way. I also had the idea of installing a custom sys.unraisablehook in regrtest and repeat all errors at exit. Maybe even make the test fail if at least one unraisable exception is logged.
There was a problem hiding this comment.
Can you URL me to that commit?
There was a problem hiding this comment.
It's not a commit but an idea :-) I didn't implement it.
There was a problem hiding this comment.
Ok, :$ ping me when implemented!
|
Oh. "del self.unraisable" was a good idea. I only used the context manager in a few places, but I already get it wrong in test_io :-) It's now fixed by this PR! |
catch_unraisable_exception() now also removes its 'unraisable' attribute at the context manager exit.
|
@tirkarthi @graingert: Would you mind to review the updated PR? |
|
@graingert: Thanks for your very good feedback, it's very valuable! |
…GH-13554) catch_unraisable_exception() now also removes its 'unraisable' attribute at the context manager exit.
catch_unraisable_exception() now also removes its 'unraisable'
attribute at the context manager exit.
https://bugs.python.org/issue36829