bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184)
This commit is contained in:
parent
10a0a09323
commit
aa542c2cf2
|
@ -2,6 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import run_unittest
|
from test.support import run_unittest
|
||||||
|
import warnings
|
||||||
|
|
||||||
from distutils.command.bdist import bdist
|
from distutils.command.bdist import bdist
|
||||||
from distutils.tests import support
|
from distutils.tests import support
|
||||||
|
@ -38,7 +39,10 @@ class BuildTestCase(support.TempdirManager,
|
||||||
names.append('bdist_msi')
|
names.append('bdist_msi')
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
subcmd = cmd.get_finalized_command(name)
|
with warnings.catch_warnings():
|
||||||
|
warnings.filterwarnings('ignore', 'bdist_wininst command is deprecated',
|
||||||
|
DeprecationWarning)
|
||||||
|
subcmd = cmd.get_finalized_command(name)
|
||||||
if getattr(subcmd, '_unsupported', False):
|
if getattr(subcmd, '_unsupported', False):
|
||||||
# command is not supported on this build
|
# command is not supported on this build
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -7,6 +7,7 @@ import array
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
|
import warnings
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
TestCase = unittest.TestCase
|
TestCase = unittest.TestCase
|
||||||
|
@ -1759,8 +1760,11 @@ class HTTPSTest(TestCase):
|
||||||
self.assertIs(h._context, context)
|
self.assertIs(h._context, context)
|
||||||
self.assertFalse(h._context.post_handshake_auth)
|
self.assertFalse(h._context.post_handshake_auth)
|
||||||
|
|
||||||
h = client.HTTPSConnection('localhost', 443, context=context,
|
with warnings.catch_warnings():
|
||||||
cert_file=CERT_localhost)
|
warnings.filterwarnings('ignore', 'key_file, cert_file and check_hostname are deprecated',
|
||||||
|
DeprecationWarning)
|
||||||
|
h = client.HTTPSConnection('localhost', 443, context=context,
|
||||||
|
cert_file=CERT_localhost)
|
||||||
self.assertTrue(h._context.post_handshake_auth)
|
self.assertTrue(h._context.post_handshake_auth)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue