]> granicus.if.org Git - python/commitdiff
bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184)
authorPablo Galindo <Pablogsal@gmail.com>
Thu, 8 Aug 2019 22:25:46 +0000 (23:25 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Aug 2019 22:25:46 +0000 (23:25 +0100)
Lib/distutils/tests/test_bdist.py
Lib/test/test_httplib.py

index c80b3edc022088fdafdf56f8ef2bbb4305ca4d38..130d8bf155a45c4ec8e95165fe03714ac0d3e240 100644 (file)
@@ -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
index 9148169cc7c2e571fd08e6f736e2458175e8f90b..656932fbaab7a43dde5912faf192c954d915bc70 100644 (file)
@@ -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)