summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-08-08 22:25:46 (GMT)
committerGitHub <noreply@github.com>2019-08-08 22:25:46 (GMT)
commitaa542c2cf26c5af9298dda6064576b18906cdfbf (patch)
tree257dc64bf89c8f100dda7613762b3f6b550ead4e
parent10a0a093231ea82a3bfd33fd63322aebd8406866 (diff)
downloadcpython-aa542c2cf26c5af9298dda6064576b18906cdfbf.zip
cpython-aa542c2cf26c5af9298dda6064576b18906cdfbf.tar.gz
cpython-aa542c2cf26c5af9298dda6064576b18906cdfbf.tar.bz2
bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184)
-rw-r--r--Lib/distutils/tests/test_bdist.py6
-rw-r--r--Lib/test/test_httplib.py8
2 files changed, 11 insertions, 3 deletions
diff --git a/Lib/distutils/tests/test_bdist.py b/Lib/distutils/tests/test_bdist.py
index c80b3ed..130d8bf 100644
--- a/Lib/distutils/tests/test_bdist.py
+++ b/Lib/distutils/tests/test_bdist.py
@@ -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,7 +39,10 @@ class BuildTestCase(support.TempdirManager,
names.append('bdist_msi')
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):
# command is not supported on this build
continue
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 9148169..656932f 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -7,6 +7,7 @@ import array
import re
import socket
import threading
+import warnings
import unittest
TestCase = unittest.TestCase
@@ -1759,8 +1760,11 @@ class HTTPSTest(TestCase):
self.assertIs(h._context, context)
self.assertFalse(h._context.post_handshake_auth)
- h = client.HTTPSConnection('localhost', 443, context=context,
- cert_file=CERT_localhost)
+ 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)