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): ...@@ -575,5 +575,5 @@ def get_config_var(name):
""" """
if name == 'SO': if name == 'SO':
import warnings 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) return get_config_vars().get(name)
...@@ -6,7 +6,7 @@ import unittest ...@@ -6,7 +6,7 @@ import unittest
from distutils import sysconfig from distutils import sysconfig
from distutils.ccompiler import get_default_compiler from distutils.ccompiler import get_default_compiler
from distutils.tests import support 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): class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -166,8 +166,9 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -166,8 +166,9 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None, @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
'EXT_SUFFIX required for this test') 'EXT_SUFFIX required for this test')
def test_SO_value(self): def test_SO_value(self):
self.assertEqual(sysconfig.get_config_var('SO'), with check_warnings(('', DeprecationWarning)):
sysconfig.get_config_var('EXT_SUFFIX')) self.assertEqual(sysconfig.get_config_var('SO'),
sysconfig.get_config_var('EXT_SUFFIX'))
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None, @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
'EXT_SUFFIX required for this test') '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