diff --git a/Lib/test/test_check_c_globals.py b/Lib/test/test_check_c_globals.py index 030debc452e4092..898807a5e69259e 100644 --- a/Lib/test/test_check_c_globals.py +++ b/Lib/test/test_check_c_globals.py @@ -1,9 +1,14 @@ import unittest import test.test_tools +from test.support.warnings_helper import save_restore_warnings_filters test.test_tools.skip_if_missing('c-analyzer') with test.test_tools.imports_under_tool('c-analyzer'): - from cpython.__main__ import main + # gh-95349: Save/restore warnings filters to leave them unchanged. + # Importing the c-analyzer imports docutils which imports pkg_resources + # which adds a warnings filter. + with save_restore_warnings_filters(): + from cpython.__main__ import main class ActualChecks(unittest.TestCase):