Commit 4f57b30b authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #19760: Silence sysconfig's 'SO' key deprecation warnings in tests.

Change stacklevel in warnings.warn() for 'SO' key to 2.
parent 58403d4a
......@@ -575,5 +575,5 @@ def get_config_var(name):
"""
if name == 'SO':
import warnings
warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning)
warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2)
return get_config_vars().get(name)
......@@ -6,7 +6,7 @@ import unittest
from distutils import sysconfig
from distutils.ccompiler import get_default_compiler
from distutils.tests import support
from test.support import TESTFN, run_unittest
from test.support import TESTFN, run_unittest, check_warnings
class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
def setUp(self):
......@@ -166,8 +166,9 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
'EXT_SUFFIX required for this test')
def test_SO_value(self):
self.assertEqual(sysconfig.get_config_var('SO'),
sysconfig.get_config_var('EXT_SUFFIX'))
with check_warnings(('', DeprecationWarning)):
self.assertEqual(sysconfig.get_config_var('SO'),
sysconfig.get_config_var('EXT_SUFFIX'))
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
'EXT_SUFFIX required for this test')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment