Commit 94ab18aa 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 acb7c3ea
...@@ -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,6 +166,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -166,6 +166,7 @@ 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):
with check_warnings(('', DeprecationWarning)):
self.assertEqual(sysconfig.get_config_var('SO'), self.assertEqual(sysconfig.get_config_var('SO'),
sysconfig.get_config_var('EXT_SUFFIX')) sysconfig.get_config_var('EXT_SUFFIX'))
......
...@@ -585,7 +585,7 @@ def get_config_var(name): ...@@ -585,7 +585,7 @@ 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)
......
...@@ -5,7 +5,7 @@ import subprocess ...@@ -5,7 +5,7 @@ import subprocess
import shutil import shutil
from copy import copy from copy import copy
from test.support import (run_unittest, TESTFN, unlink, from test.support import (run_unittest, TESTFN, unlink, check_warnings,
captured_stdout, skip_unless_symlink) captured_stdout, skip_unless_symlink)
import sysconfig import sysconfig
...@@ -378,6 +378,7 @@ class TestSysConfig(unittest.TestCase): ...@@ -378,6 +378,7 @@ class TestSysConfig(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):
with check_warnings(('', DeprecationWarning)):
self.assertEqual(sysconfig.get_config_var('SO'), self.assertEqual(sysconfig.get_config_var('SO'),
sysconfig.get_config_var('EXT_SUFFIX')) sysconfig.get_config_var('EXT_SUFFIX'))
......
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