[Python-checkins] [3.8] bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184) (GH-15188)
Pablo Galindo
webhook-mailer at python.org
Thu Aug 8 20:23:02 EDT 2019
https://github.com/python/cpython/commit/162d45c531552d0699f945d2c22a763941dca3c1
commit: 162d45c531552d0699f945d2c22a763941dca3c1
branch: 3.8
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-08-09T01:22:59+01:00
summary:
[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 at gmail.com>
files:
M Lib/distutils/tests/test_bdist.py
M Lib/test/test_httplib.py
diff --git a/Lib/distutils/tests/test_bdist.py b/Lib/distutils/tests/test_bdist.py
index c80b3edc0220..130d8bf155a4 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 @@ def test_skip_build(self):
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 9148169cc7c2..656932fbaab7 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -7,6 +7,7 @@
import re
import socket
import threading
+import warnings
import unittest
TestCase = unittest.TestCase
@@ -1759,8 +1760,11 @@ def test_tls13_pha(self):
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)
More information about the Python-checkins
mailing list