summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-26 15:08:24 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-26 15:08:24 (GMT)
commiteaec3597ddf41facfb7b6ec4f23a372beae88764 (patch)
treeca4e3b6bbf1927b5865d2f53660c00726bc39cf3 /Lib
parent59463d8340731e228bad77893d840cf43e52b98e (diff)
downloadcpython-eaec3597ddf41facfb7b6ec4f23a372beae88764.zip
cpython-eaec3597ddf41facfb7b6ec4f23a372beae88764.tar.gz
cpython-eaec3597ddf41facfb7b6ec4f23a372beae88764.tar.bz2
Issue #19760: Silence sysconfig's 'SO' key deprecation warnings in tests.
Change stacklevel in warnings.warn() for 'SO' key to 2.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/sysconfig.py2
-rw-r--r--Lib/distutils/tests/test_sysconfig.py7
-rw-r--r--Lib/sysconfig.py2
-rw-r--r--Lib/test/test_sysconfig.py7
4 files changed, 10 insertions, 8 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 392d63d..75537db 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -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)
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index e14646e..b5fdc98 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -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')
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index ffa772e..dbf7767 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -585,7 +585,7 @@ 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)
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 5bc3f32..804c446 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -5,7 +5,7 @@ import subprocess
import shutil
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)
import sysconfig
@@ -378,8 +378,9 @@ class TestSysConfig(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')