Skip to content

Commit dde2b9d

Browse files
committed
Remove support for cast of iterable of entry points to dict. Ref #97.
1 parent 0c81964 commit dde2b9d

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

importlib_metadata/__init__.py

-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pathlib
99
import operator
1010
import textwrap
11-
import warnings
1211
import functools
1312
import itertools
1413
import posixpath
@@ -187,17 +186,6 @@ def _for(self, dist):
187186
self.dist = dist
188187
return self
189188

190-
def __iter__(self):
191-
"""
192-
Supply iter so one may construct dicts of EntryPoints by name.
193-
"""
194-
msg = (
195-
"Construction of dict of EntryPoints is deprecated in "
196-
"favor of EntryPoints."
197-
)
198-
warnings.warn(msg, DeprecationWarning)
199-
return iter((self.name, self))
200-
201189
def __reduce__(self):
202190
return (
203191
self.__class__,

tests/test_api.py

-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
import textwrap
33
import unittest
4-
import warnings
54
import importlib
65

76
from . import fixtures
@@ -116,23 +115,6 @@ def test_entry_points_missing_name(self):
116115
def test_entry_points_missing_group(self):
117116
assert entry_points(group='missing') == ()
118117

119-
def test_entry_points_dict_construction(self):
120-
"""
121-
Prior versions of entry_points() returned simple lists and
122-
allowed casting those lists into maps by name using ``dict()``.
123-
Capture this now deprecated use-case.
124-
"""
125-
with warnings.catch_warnings(record=True) as caught:
126-
eps = dict(entry_points(group='entries'))
127-
128-
assert 'main' in eps
129-
assert eps['main'] == entry_points(group='entries')['main']
130-
131-
# check warning
132-
expected = next(iter(caught))
133-
assert expected.category is DeprecationWarning
134-
assert "Construction of dict of EntryPoints is deprecated" in str(expected)
135-
136118
def test_metadata_for_this_package(self):
137119
md = metadata('egginfo-pkg')
138120
assert md['author'] == 'Steven Ma'

tests/test_main.py

-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import re
2-
import json
32
import pickle
43
import textwrap
54
import unittest
6-
import warnings
75
import importlib
86
import importlib_metadata
97
import pyfakefs.fake_filesystem_unittest as ffs
@@ -243,14 +241,6 @@ def test_hashable(self):
243241
"""EntryPoints should be hashable"""
244242
hash(self.ep)
245243

246-
def test_json_dump(self):
247-
"""
248-
json should not expect to be able to dump an EntryPoint
249-
"""
250-
with self.assertRaises(Exception):
251-
with warnings.catch_warnings(record=True):
252-
json.dumps(self.ep)
253-
254244
def test_module(self):
255245
assert self.ep.module == 'value'
256246

0 commit comments

Comments
 (0)