@@ -48,11 +48,13 @@ def dash_R(ns, test_name, test_func):
48
48
else :
49
49
zdc = zipimport ._zip_directory_cache .copy ()
50
50
abcs = {}
51
- for abc in [getattr (collections .abc ,a )for a in collections .abc .__all__ ]:
52
- if not isabstract (abc ):
53
- continue
54
- for obj in abc .__subclasses__ ()+ [abc ]:
55
- abcs [obj ]= _get_dump (obj )[0 ]
51
+ # catch and ignore collections.abc.ByteString deprecation
52
+ with warnings .catch_warnings (action = 'ignore' ,category = DeprecationWarning ):
53
+ for abc in [getattr (collections .abc ,a )for a in collections .abc .__all__ ]:
54
+ if not isabstract (abc ):
55
+ continue
56
+ for obj in abc .__subclasses__ ()+ [abc ]:
57
+ abcs [obj ]= _get_dump (obj )[0 ]
56
58
57
59
# bpo-31217: Integer pool to get a single integer object for the same
58
60
# value. The pool is used to prevent false alarm when checking for memory
@@ -173,7 +175,9 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
173
175
zipimport ._zip_directory_cache .update (zdc )
174
176
175
177
# Clear ABC registries, restoring previously saved ABC registries.
176
- abs_classes = [getattr (collections .abc ,a )for a in collections .abc .__all__ ]
178
+ # ignore deprecation warning for collections.abc.ByteString
179
+ with warnings .catch_warnings (action = 'ignore' ,category = DeprecationWarning ):
180
+ abs_classes = [getattr (collections .abc ,a )for a in collections .abc .__all__ ]
177
181
abs_classes = filter (isabstract ,abs_classes )
178
182
for abc in abs_classes :
179
183
for obj in abc .__subclasses__ ()+ [abc ]: