[3.8] bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184) (GH-15188)
(cherry picked from commit aa542c2
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
5925b7d555
commit
162d45c531
|
@ -2,6 +2,7 @@
|
|||
import os
|
||||
import unittest
|
||||
from test.support import run_unittest
|
||||
import warnings
|
||||
|
||||
from distutils.command.bdist import bdist
|
||||
from distutils.tests import support
|
||||
|
@ -38,6 +39,9 @@ class BuildTestCase(support.TempdirManager,
|
|||
names.append('bdist_msi')
|
||||
|
||||
for name in names:
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', 'bdist_wininst command is deprecated',
|
||||
DeprecationWarning)
|
||||
subcmd = cmd.get_finalized_command(name)
|
||||
if getattr(subcmd, '_unsupported', False):
|
||||
# command is not supported on this build
|
||||
|
|
|
@ -7,6 +7,7 @@ import array
|
|||
import re
|
||||
import socket
|
||||
import threading
|
||||
import warnings
|
||||
|
||||
import unittest
|
||||
TestCase = unittest.TestCase
|
||||
|
@ -1759,6 +1760,9 @@ class HTTPSTest(TestCase):
|
|||
self.assertIs(h._context, context)
|
||||
self.assertFalse(h._context.post_handshake_auth)
|
||||
|
||||
with warnings.catch_warnings():
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue