File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,22 @@ def test_entry_points_dict_construction(self):
133133 assert expected .category is DeprecationWarning
134134 assert "Construction of dict of EntryPoints is deprecated" in str (expected )
135135
136+ def test_entry_points_by_index (self ):
137+ """
138+ Prior versions of Distribution.entry_points would return a
139+ tuple that allowed access by index.
140+ Capture this now deprecated use-case
141+ See python/importlib_metadata#300 and bpo-44246.
142+ """
143+ eps = distribution ('distinfo-pkg' ).entry_points
144+ with warnings .catch_warnings (record = True ) as caught :
145+ eps [0 ]
146+
147+ # check warning
148+ expected = next (iter (caught ))
149+ assert expected .category is DeprecationWarning
150+ assert "Accessing entry points by index is deprecated" in str (expected )
151+
136152 def test_entry_points_groups_getitem (self ):
137153 """
138154 Prior versions of entry_points() returned a dict. Ensure
You can’t perform that action at this time.
0 commit comments