Skip to content

Commit

Permalink
Remove support for cast of iterable of entry points to dict. Ref #97.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 1, 2022
1 parent 0c81964 commit dde2b9d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 40 deletions.
12 changes: 0 additions & 12 deletions importlib_metadata/__init__.py
Expand Up @@ -8,7 +8,6 @@
import pathlib
import operator
import textwrap
import warnings
import functools
import itertools
import posixpath
Expand Down Expand Up @@ -187,17 +186,6 @@ def _for(self, dist):
self.dist = dist
return self

def __iter__(self):
"""
Supply iter so one may construct dicts of EntryPoints by name.
"""
msg = (
"Construction of dict of EntryPoints is deprecated in "
"favor of EntryPoints."
)
warnings.warn(msg, DeprecationWarning)
return iter((self.name, self))

def __reduce__(self):
return (
self.__class__,
Expand Down
18 changes: 0 additions & 18 deletions tests/test_api.py
@@ -1,7 +1,6 @@
import re
import textwrap
import unittest
import warnings
import importlib

from . import fixtures
Expand Down Expand Up @@ -116,23 +115,6 @@ def test_entry_points_missing_name(self):
def test_entry_points_missing_group(self):
assert entry_points(group='missing') == ()

def test_entry_points_dict_construction(self):
"""
Prior versions of entry_points() returned simple lists and
allowed casting those lists into maps by name using ``dict()``.
Capture this now deprecated use-case.
"""
with warnings.catch_warnings(record=True) as caught:
eps = dict(entry_points(group='entries'))

assert 'main' in eps
assert eps['main'] == entry_points(group='entries')['main']

# check warning
expected = next(iter(caught))
assert expected.category is DeprecationWarning
assert "Construction of dict of EntryPoints is deprecated" in str(expected)

def test_metadata_for_this_package(self):
md = metadata('egginfo-pkg')
assert md['author'] == 'Steven Ma'
Expand Down
10 changes: 0 additions & 10 deletions tests/test_main.py
@@ -1,9 +1,7 @@
import re
import json
import pickle
import textwrap
import unittest
import warnings
import importlib
import importlib_metadata
import pyfakefs.fake_filesystem_unittest as ffs
Expand Down Expand Up @@ -243,14 +241,6 @@ def test_hashable(self):
"""EntryPoints should be hashable"""
hash(self.ep)

def test_json_dump(self):
"""
json should not expect to be able to dump an EntryPoint
"""
with self.assertRaises(Exception):
with warnings.catch_warnings(record=True):
json.dumps(self.ep)

def test_module(self):
assert self.ep.module == 'value'

Expand Down

0 comments on commit dde2b9d

Please sign in to comment.