Fix test_trailing_slash_directory_metadata for Python 3.15#13902
Fix test_trailing_slash_directory_metadata for Python 3.15#13902
test_trailing_slash_directory_metadata for Python 3.15#13902Conversation
Python 3.15 alpha tightened importlib.metadata to raise MetadataNotFound eagerly when no metadata files exist. The test used a fake non-existent path; replace with a real temp directory containing a minimal PKG-INFO. Fixes pypa#13901.
|
Do we know what changed upstream to break this? |
|
CPython 3.15.0a8 intentionally changed
The test was using a fake non-existent path, which worked before because accessing There's also a related regression tracked upstream: python/cpython#143387 |
|
The upstream fix is python/cpython#146234 (merged). The original change that introduced |
|
@sbidoul this should fix failing CI on main. I haven't reviewed this yet, FWIW. |
|
Looks good, thanks! |
Summary
Python 3.15 alpha tightened
importlib.metadatato raiseMetadataNotFoundeagerly when no metadata files exist on disk. The test used a fake non-existent path (/path/to/foo.egg-info) to verify trailing-slash handling — this worked on older Pythons where metadata access was lazy, but now fails on 3.15.Replace the fake path with a real temp directory containing a minimal
PKG-INFOfile. The test still verifies the same behavior (name parsing and trailing-slash normalization).Fixes #13901.
Test plan
nox -s test-3.15 -- tests/unit/metadata/test_metadata.py::test_trailing_slash_directory_metadata— 2 passed (Python 3.15.0a8)nox -s test-3.12 -- tests/unit/metadata/test_metadata.py::test_trailing_slash_directory_metadata— 2 passed (Python 3.12.3)