summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-10 10:57:32 (GMT)
committerGitHub <noreply@github.com>2022-08-10 10:57:32 (GMT)
commit2c4bd21630b6de45a211e3a8c0aea38abe4c58f2 (patch)
tree7860d5c3483690a1ec47a21282305327f817a6ab
parenta42215c7e1e5a209b1bfb4cd02b52c7c1999f5cf (diff)
downloadcpython-2c4bd21630b6de45a211e3a8c0aea38abe4c58f2.zip
cpython-2c4bd21630b6de45a211e3a8c0aea38abe4c58f2.tar.gz
cpython-2c4bd21630b6de45a211e3a8c0aea38abe4c58f2.tar.bz2
gh-95349: Hide a Distutils Warning Filter for test_check_c_globals (GH-95837) (GH-95843)
Under certain build conditions, test_check_c_globals fails. This fix takes the same approach as we took for gh-84236 (via gh-20095). We'll be removing use of distutils in the c-analyzer at some point. Until then we'll hide the warning filter. (cherry picked from commit 3ff6d9affb351292ad8530802e7c06f651520706) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
-rw-r--r--Lib/test/test_check_c_globals.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_check_c_globals.py b/Lib/test/test_check_c_globals.py
index 030debc..898807a 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):