Skip to content

Commit

Permalink
bpo-44785: Silence deprecation warnings in test_pickle (GH-27538)
Browse files Browse the repository at this point in the history
(cherry picked from commit 36d952d)

Co-authored-by: Serhiy Storchaka <[email protected]>
  • Loading branch information
miss-islington and serhiy-storchaka authored Aug 2, 2021
1 parent 2cc19a5 commit aa72668
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Lib/test/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import collections
import struct
import sys
import warnings
import weakref

import unittest
Expand Down Expand Up @@ -367,7 +368,10 @@ def getmodule(module):
return sys.modules[module]
except KeyError:
try:
__import__(module)
with warnings.catch_warnings():
action = 'always' if support.verbose else 'ignore'
warnings.simplefilter(action, DeprecationWarning)
__import__(module)
except AttributeError as exc:
if support.verbose:
print("Can't import module %r: %s" % (module, exc))
Expand Down

0 comments on commit aa72668

Please sign in to comment.