Skip to content

Commit ccb7257

Browse files
hroncokConan-Kudo
authored andcommitted
test: Add PKG-INFO to egg-info mocks for Python 3.15 compatibility
Python 3.15's importlib.metadata now strictly requires PKG-INFO files in egg-info directories when accessing the requires property. Without it, self.metadata is None and triggers AttributeError when reading d.requires. Although reported as a regression, upstream chose to enforce this requirement rather than handle missing metadata gracefully. python/cpython#143387 In near future, it will raise MetadataNotFound(FileNotFoundError). python/cpython#146234
1 parent 832b93e commit ccb7257

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

test/mockdata/mock_python.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,20 @@
191191
PythonIcecreamPackage = get_tested_mock_package(
192192
lazyload=True,
193193
files={
194+
'/usr/lib/python3.10/site-packages/icecream-2.1.3-py3.10.egg-info/PKG-INFO': {
195+
'content': """Metadata-Version: 2.1
196+
Name: icecream
197+
Version: 2.1.3
198+
""",
199+
'create_dirs': True
200+
},
194201
'/usr/lib/python3.10/site-packages/icecream-2.1.3-py3.10.egg-info/requires.txt': {
195202
'content': """
196203
asttokens>=2.0.1
197204
colorama>=0.3.9
198205
executing>=0.3.1
199206
pygments>=2.2.0
200207
""",
201-
'create_dirs': True
202208
},
203209
},
204210
header={
@@ -278,6 +284,12 @@
278284
IPythonMissingRequirePackage = get_tested_mock_package(
279285
lazyload=True,
280286
files={
287+
'/usr/lib/python3.12/site-packages/ipython-8.14.0-py3.12.egg-info/PKG-INFO': {
288+
'content': """Metadata-Version: 2.1
289+
Name: ipython
290+
Version: 8.14.0
291+
""",
292+
},
281293
'/usr/lib/python3.12/site-packages/ipython-8.14.0-py3.12.egg-info/requires.txt': {
282294
'content-path': 'files/ipython-requires.txt',
283295
},

0 commit comments

Comments
 (0)