File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ import contextlib
12import pathlib
23import sys
34import unittest
5+ import warnings
46
57from importlib_metadata import (
68 distribution ,
@@ -63,6 +65,9 @@ def test_compatibility_with_old_stdlib_path_distribution(self):
6365 Ref python/importlib_metadata#396.
6466 """
6567 self .fixtures .enter_context (fixtures .install_finder (self ._meta_path_finder ()))
68+ self .fixtures .enter_context (
69+ suppress_unrecognized_distribution_subclass_warning ()
70+ )
6671
6772 assert list (distributions ())
6873 assert distribution ("distinfo_pkg" )
@@ -72,3 +77,15 @@ def test_compatibility_with_old_stdlib_path_distribution(self):
7277 assert list (metadata ("distinfo_pkg" ))
7378 assert list (metadata ("distinfo_pkg_custom" ))
7479 assert list (entry_points (group = "entries" ))
80+
81+
82+ @contextlib .contextmanager
83+ def suppress_unrecognized_distribution_subclass_warning ():
84+ with warnings .catch_warnings ():
85+ warnings .filterwarnings (
86+ "ignore" ,
87+ category = UserWarning ,
88+ message = "Unrecognized distribution subclass" ,
89+ append = True ,
90+ )
91+ yield
You can’t perform that action at this time.
0 commit comments