diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-05-31 16:19:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 16:19:42 (GMT) |
commit | c34ed08d975fb7daa7b329f7c631647782290393 (patch) | |
tree | 6f6456952acac2ba522a559fae2570e769c322b4 /Lib/test/test_importlib | |
parent | 410b70d39d9d77384f8b8597560f6731530149ca (diff) | |
download | cpython-c34ed08d975fb7daa7b329f7c631647782290393.zip cpython-c34ed08d975fb7daa7b329f7c631647782290393.tar.gz cpython-c34ed08d975fb7daa7b329f7c631647782290393.tar.bz2 |
bpo-44246: Restore compatibility in entry_points (GH-26468)
* bpo-44246: Entry points performance improvements.
From importlib_metadata 4.3.1.
* bpo-44246: Sync with importlib_metadata 4.4
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r-- | Lib/test/test_importlib/test_metadata_api.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py index 825edc1..3506493 100644 --- a/Lib/test/test_importlib/test_metadata_api.py +++ b/Lib/test/test_importlib/test_metadata_api.py @@ -130,6 +130,22 @@ class APITests( assert expected.category is DeprecationWarning assert "Construction of dict of EntryPoints is deprecated" in str(expected) + def test_entry_points_by_index(self): + """ + Prior versions of Distribution.entry_points would return a + tuple that allowed access by index. + Capture this now deprecated use-case + See python/importlib_metadata#300 and bpo-44246. + """ + eps = distribution('distinfo-pkg').entry_points + with warnings.catch_warnings(record=True) as caught: + eps[0] + + # check warning + expected = next(iter(caught)) + assert expected.category is DeprecationWarning + assert "Accessing entry points by index is deprecated" in str(expected) + def test_entry_points_groups_getitem(self): # Prior versions of entry_points() returned a dict. Ensure # that callers using '.__getitem__()' are supported but warned to |