diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-16 12:33:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 12:33:10 (GMT) |
commit | b136b1aac4b7d07e3120ee59e41c02bc86032162 (patch) | |
tree | 5e8daa88492802a1c45b84cad0f7c4933a1394ea /Lib/test/test_socketserver.py | |
parent | 75ec103b3adbb7c619a0e22fa60f3d34c5a9e603 (diff) | |
download | cpython-b136b1aac4b7d07e3120ee59e41c02bc86032162.zip cpython-b136b1aac4b7d07e3120ee59e41c02bc86032162.tar.gz cpython-b136b1aac4b7d07e3120ee59e41c02bc86032162.tar.bz2 |
bpo-43843: libregrtest uses threading.excepthook (GH-25400)
test.libregrtest now marks a test as ENV_CHANGED (altered the
execution environment) if a thread raises an exception but does not
catch it. It sets a hook on threading.excepthook. Use
--fail-env-changed option to mark the test as failed.
libregrtest regrtest_unraisable_hook() explicitly flushs
sys.stdout, sys.stderr and sys.__stderr__.
Diffstat (limited to 'Lib/test/test_socketserver.py')
-rw-r--r-- | Lib/test/test_socketserver.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 954e033..211321f 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -323,8 +323,11 @@ class ErrorHandlerTest(unittest.TestCase): self.check_result(handled=True) def test_threading_not_handled(self): - ThreadingErrorTestServer(SystemExit) - self.check_result(handled=False) + with threading_helper.catch_threading_exception() as cm: + ThreadingErrorTestServer(SystemExit) + self.check_result(handled=False) + + self.assertIs(cm.exc_type, SystemExit) @requires_forking def test_forking_handled(self): |