Skip to content

Commit 36d952d

Browse files
bpo-44785: Silence deprecation warnings in test_pickle (#27538)
1 parent db3774d commit 36d952d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: Lib/test/test_pickle.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import collections
77
import struct
88
import sys
9+
import warnings
910
import weakref
1011

1112
import unittest
@@ -367,7 +368,10 @@ def getmodule(module):
367368
return sys.modules[module]
368369
except KeyError:
369370
try:
370-
__import__(module)
371+
with warnings.catch_warnings():
372+
action = 'always' if support.verbose else 'ignore'
373+
warnings.simplefilter(action, DeprecationWarning)
374+
__import__(module)
371375
except AttributeError as exc:
372376
if support.verbose:
373377
print("Can't import module %r: %s" % (module, exc))

0 commit comments

Comments
 (0)