Skip to content

Commit 162d45c

Browse files
authored
[3.8] bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184) (GH-15188)
(cherry picked from commit aa542c2) Co-authored-by: Pablo Galindo <[email protected]>
1 parent 5925b7d commit 162d45c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Lib/distutils/tests/test_bdist.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import unittest
44
from test.support import run_unittest
5+
import warnings
56

67
from distutils.command.bdist import bdist
78
from distutils.tests import support
@@ -38,7 +39,10 @@ def test_skip_build(self):
3839
names.append('bdist_msi')
3940

4041
for name in names:
41-
subcmd = cmd.get_finalized_command(name)
42+
with warnings.catch_warnings():
43+
warnings.filterwarnings('ignore', 'bdist_wininst command is deprecated',
44+
DeprecationWarning)
45+
subcmd = cmd.get_finalized_command(name)
4246
if getattr(subcmd, '_unsupported', False):
4347
# command is not supported on this build
4448
continue

Lib/test/test_httplib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
import socket
99
import threading
10+
import warnings
1011

1112
import unittest
1213
TestCase = unittest.TestCase
@@ -1759,8 +1760,11 @@ def test_tls13_pha(self):
17591760
self.assertIs(h._context, context)
17601761
self.assertFalse(h._context.post_handshake_auth)
17611762

1762-
h = client.HTTPSConnection('localhost', 443, context=context,
1763-
cert_file=CERT_localhost)
1763+
with warnings.catch_warnings():
1764+
warnings.filterwarnings('ignore', 'key_file, cert_file and check_hostname are deprecated',
1765+
DeprecationWarning)
1766+
h = client.HTTPSConnection('localhost', 443, context=context,
1767+
cert_file=CERT_localhost)
17641768
self.assertTrue(h._context.post_handshake_auth)
17651769

17661770

0 commit comments

Comments
 (0)