[3.13] gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings, and internal test warnings that are now logged (#131802)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
(cherry picked from commit 8a00c9a4d2)
This commit is contained in:
Thomas Grainger 2025-03-29 19:21:33 +00:00 committed by GitHub
parent 5c2c817723
commit 07d4c7e7db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 234 additions and 138 deletions

View file

@ -24,6 +24,7 @@ you're working through IDLE, you can import this test module and call test()
with the corresponding argument.
"""
import logging
import math
import os, sys
import operator
@ -5932,8 +5933,9 @@ def tearDownModule():
if C: C.setcontext(ORIGINAL_CONTEXT[C].copy())
P.setcontext(ORIGINAL_CONTEXT[P].copy())
if not C:
warnings.warn('C tests skipped: no module named _decimal.',
UserWarning)
logging.getLogger(__name__).warning(
'C tests skipped: no module named _decimal.'
)
if not orig_sys_decimal is sys.modules['decimal']:
raise TestFailed("Internal error: unbalanced number of changes to "
"sys.modules['decimal'].")