summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-08-02 16:11:12 (GMT)
committerGitHub <noreply@github.com>2021-08-02 16:11:12 (GMT)
commit36d952d228582b0ffc7a86c520d4ddbe8943d803 (patch)
treec2ebb0d74b8b1ad096e2b1718c65334e4eb2f490
parentdb3774d063bea27b80529efe781ae942986f0d17 (diff)
downloadcpython-36d952d228582b0ffc7a86c520d4ddbe8943d803.zip
cpython-36d952d228582b0ffc7a86c520d4ddbe8943d803.tar.gz
cpython-36d952d228582b0ffc7a86c520d4ddbe8943d803.tar.bz2
bpo-44785: Silence deprecation warnings in test_pickle (#27538)
-rw-r--r--Lib/test/test_pickle.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 23c7bd2..f8b43a1 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -6,6 +6,7 @@ import io
import collections
import struct
import sys
+import warnings
import weakref
import unittest
@@ -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))