Skip to content

Commit 2c874e7

Browse files
authored
Merge pull request #4962 from pypa/bugfix/4961-validated-eps
Update test to honor new behavior in importlib_metadata 8.7
2 parents ef4cd29 + 82c588a commit 2c874e7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

newsfragments/4961.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update test to honor new behavior in importlib_metadata 8.7.

setuptools/_entry_points.py

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def ensure_valid(ep):
1515
"""
1616
Exercise one of the dynamic properties to trigger
1717
the pattern match.
18+
19+
This function is deprecated in favor of importlib_metadata 8.7 and
20+
Python 3.14 importlib.metadata, which validates entry points on
21+
construction.
1822
"""
1923
try:
2024
ep.extras

setuptools/tests/test_egg_info.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1287,10 +1287,11 @@ def test_invalid_entry_point(self, tmpdir_cwd, env):
12871287
dist = Distribution({"name": "foo", "version": "0.0.1"})
12881288
dist.entry_points = {"foo": "foo = invalid-identifier:foo"}
12891289
cmd = dist.get_command_obj("egg_info")
1290-
expected_msg = r"Problems to parse .*invalid-identifier.*"
1291-
with pytest.raises(errors.OptionError, match=expected_msg) as ex:
1290+
expected_msg = r"(Invalid object reference|Problems to parse)"
1291+
with pytest.raises((errors.OptionError, ValueError), match=expected_msg) as ex:
12921292
write_entries(cmd, "entry_points", "entry_points.txt")
12931293
assert "ensure entry-point follows the spec" in ex.value.args[0]
1294+
assert "invalid-identifier" in str(ex.value)
12941295

12951296
def test_valid_entry_point(self, tmpdir_cwd, env):
12961297
dist = Distribution({"name": "foo", "version": "0.0.1"})

0 commit comments

Comments
 (0)