setuptools: [BUG] [doctest] pkg_resources.NullProvider._validate_resource_path and TestWriteEntries.test_invalid_entry_point fail with Python 3.13.0a3
setuptools version
69.0.3
Python version
Python 3.13.0a3
OS
Fedora Linux 40
Additional environment information
This happens in the context of the RPM build of setuptools for Fedora Linux.
Description
Two test fail when building setuptools with Python 3.13.0a3
Expected behavior
Test pass
How to Reproduce
Happy to test it in the RPM environment.
Output
=================================== FAILURES ===================================
_________ [doctest] pkg_resources.NullProvider._validate_resource_path _________
1609 >>> vrp('foo/../../bar.txt')
1610 >>> bool(warned)
1611 True
1612 >>> warned.clear()
1613 >>> vrp('foo/f../bar.txt')
1614 >>> bool(warned)
1615 False
1616
1617 Windows path separators are straight-up disallowed.
1618 >>> vrp(r'\foo/bar.txt')
Expected:
Traceback (most recent call last):
...
ValueError: Use of .. or absolute path in a resource path is not allowed.
Got nothing
/builddir/build/BUILD/setuptools-69.0.3/pkg_resources/__init__.py:1618: DocTestFailure
__________________ TestWriteEntries.test_invalid_entry_point ___________________
self = <setuptools.tests.test_egg_info.TestWriteEntries object at 0x7ff1e7d28a40>
tmpdir_cwd = local('/builddir/build/BUILD/setuptools-69.0.3')
env = '/tmp/setuptools-test.no9jl_q9'
def test_invalid_entry_point(self, tmpdir_cwd, env):
dist = Distribution({"name": "foo", "version": "0.0.1"})
dist.entry_points = {"foo": "foo = invalid-identifier:foo"}
cmd = dist.get_command_obj("egg_info")
expected_msg = r"Problems to parse .*invalid-identifier.*"
with pytest.raises(errors.OptionError, match=expected_msg) as ex:
> write_entries(cmd, "entry_points", "entry_points.txt")
/builddir/build/BUILD/setuptools-69.0.3/setuptools/tests/test_egg_info.py:1310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/builddir/build/BUILD/setuptools-69.0.3/setuptools/command/egg_info.py:722: in write_entries
eps = _entry_points.load(cmd.distribution.entry_points)
/usr/lib64/python3.13/functools.py:911: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/builddir/build/BUILD/setuptools-69.0.3/setuptools/_entry_points.py:59: in load
return validate(metadata.EntryPoints(groups))
/builddir/build/BUILD/setuptools-69.0.3/setuptools/_entry_points.py:47: in validate
consume(map(ensure_valid, ensure_unique(eps, key=by_group_and_name)))
/builddir/build/BUILD/setuptools-69.0.3/setuptools/_vendor/more_itertools/recipes.py:139: in consume
deque(iterator, maxlen=0)
/builddir/build/BUILD/setuptools-69.0.3/setuptools/_entry_points.py:19: in ensure_valid
ep.extras
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = EntryPoint(name='foo', value='invalid-identifier:foo', group='foo')
@property
def extras(self) -> List[str]:
match = self.pattern.match(self.value)
> assert match is not None
E AssertionError
/usr/lib64/python3.13/importlib/metadata/__init__.py:197: AssertionError
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- Make the validation test for entry-points work with Python 3.13+ The exception in importlib.metadata has changed. See https://github.com/python/importlib_metadata/issues/488 This make an existing te... — committed to hroncok/setuptools by hroncok 3 years ago
- Make the validation test for entry-points work with Python 3.13+ The exception in importlib.metadata has changed. See https://github.com/python/importlib_metadata/issues/488 This makes an existing t... — committed to hroncok/setuptools by hroncok 3 years ago
- Explicitly disallow resource paths starting with single backslash Previously, such paths were disallowed implicitly as they were treated as Windows absolute paths. Since Python 3.13, paths starting ... — committed to pypa/setuptools by hroncok 3 years ago
- Explicitly disallow resource paths starting with single backslash Previously, such paths were disallowed implicitly as they were treated as Windows absolute paths. Since Python 3.13, paths starting ... — committed to pypa/pkg_resources by hroncok 3 years ago
And https://github.com/pypa/setuptools/pull/4357
https://github.com/pypa/setuptools/pull/4356
https://docs.python.org/3.13/library/os.path.html#os.path.isabs