summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-08-02 16:39:25 (GMT)
committerGitHub <noreply@github.com>2021-08-02 16:39:25 (GMT)
commit4817c1439519081d7bd9b396bb18b0f4124613be (patch)
tree2af751a3c09d49d0819bcb85a63f31081a7ec258
parent2ee09597f2418f5c038ad4f536ca87a324133d5c (diff)
downloadcpython-4817c1439519081d7bd9b396bb18b0f4124613be.zip
cpython-4817c1439519081d7bd9b396bb18b0f4124613be.tar.gz
cpython-4817c1439519081d7bd9b396bb18b0f4124613be.tar.bz2
bpo-44785: Silence deprecation warnings in test_pickle (GH-27538) (#27557)
(cherry picked from commit 36d952d228582b0ffc7a86c520d4ddbe8943d803) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-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 2307b13..70672dc 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
@@ -366,7 +367,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))