Skip to content

Commit

Permalink
bpo-37795: Capture DeprecationWarnings in the test suite (pythonGH-15184
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pablogsal authored Aug 8, 2019
1 parent 10a0a09 commit aa542c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Lib/distutils/tests/test_bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re
import socket
import threading
import warnings

import unittest
TestCase = unittest.TestCase
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit aa542c2

Please sign in to comment.