Skip to content

test_license_reference_to_file_beside_package_manifest test is broken #4540

@gotmax23

Description

@gotmax23

Description

Please leave a brief description of the bug or feature request:

test_license_reference_to_file_beside_package_manifest in tests/packagedcode/test_license_detection.py is broken with importlib_metadata versions newer than the two-year-old version that scancode pins for some reason. This breakage is due to changes made in python/importlib_metadata#437 (in particular, "Distribution.files: Only return files that actually exist"). This affects Fedora's package build that does not use old pinned dependencies. The test data in tests/packagedcode/data/license_detection/reference-to-license-beside-manifest/beartype-0.17.2 has a beartype-0.17.2.dist-info/RECORD file that references files that don't actually exist in the beartype package in the test data. This causes the following error.

E                       file_references:
E                         - path: beartype/__init__.py
E                           size: 9331
E                           sha1:
E                           md5:
E                           sha256: 20ec758584c77bdbf3d2eae4e22208c85ed6e686c91d6d2be572e00f4f10885f
E             -             sha512:
E             -             extra_data: {}
E             -           - path: beartype/meta.py
E             -             size: 32328
E             -             sha1:
E             -             md5:
E             -             sha256: b60a4c1f3177e1fa8bb244d0ba0f2fba9ab02df1dcaf82ca4ac0ba5814cf91ac
E             -             sha512:
E             -             extra_data: {}
E             -           - path: beartype/py.typed
E             -             size: '0'
E             -             sha1:
E             -             md5:
E             -             sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
E                           sha512:
E                           extra_data: {}

The correct solution would be to either:

  • fix the RECORD file so that it reflects files that actually exist in the test data and remove the invalid lines;
  • or to add the missing files to the test data

@AyanSinhaMahapatra, I think you added this test in 127bd49#diff-e59874106002ae427d750a17669f76761bfcaf794d4911b1794563ecf85f569f. Do you have a preferred way forward?

How To Reproduce

Tell us how to reproduce the issue.

pytest -k test_license_reference_to_file_beside_package_manifest tests/packagedcode/test_license_detection.py

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? Fedora Linux Rawhide (44)
  • What version of scancode-toolkit was used to generate the scan file? 32.4.1
  • What installation method was used to install/run scancode? (pip/source download/other) from source

Here are the exact versions Fedora is using in case that helps:

$ pip freeze
alabaster==0.7.16
attrs==25.3.0
babel==2.17.0
banal==1.0.6
beartype==0.22.0
beautifulsoup4==4.13.5
binaryornot==0.4.4
boolean.py==5.0
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.4.3
click==8.2.2
colorama==0.4.6
commoncode==32.3.0
container-inspector==33.0.1
cryptography==45.0.4
debian_inspector==31.1.0
dockerfile-parse==2.0.1
docutils==0.21.2
dparse2==0.7.0
extractcode==31.0.0
extractcode_7z_system_provided==16.5.210531
extractcode_libarchive_system_provided==3.5.1.210531
fasteners==0.20
fingerprints==1.2.3
ftfy==6.3.1
gemfileparser2==0.9.4
html5lib==1.1
idna==3.10
imagesize==1.4.1
importlib_metadata==8.7.0
iniconfig==2.1.0
intbitset==4.0.0
jaraco.functools==4.1.0
javaproperties==0.8.2
Jinja2==3.1.6
jsonstreams==0.6.0
license-expression==30.4.4
lxml==6.0.1
MarkupSafe==3.0.2
more-itertools==10.5.0
normality==2.5.0
packageurl-python==0.16.0
packaging==25.0
packvers==21.5
parameter-expansion-patched==0.3.1
pdfminer.six==20250506
pefile==2024.8.26
pip-requirements-parser==32.0.1
pkginfo==1.12.1.2
pluggy==1.6.0
plugincode==32.0.0
ply==3.11
publicsuffix2==2.20191221
pyahocorasick==2.2.0
pycparser==2.22
pygmars==1.0.0
Pygments==2.19.1
pymaven-patch==0.3.2
pyparsing==3.1.2
pytest==8.3.5
PyYAML==6.0.2
rdflib==7.1.4
requests==2.32.5
roman-numerals-py==3.1.0
saneyaml==0.6.0
scancode-toolkit==32.4.1
semantic_version==2.10.0
setuptools==78.1.1
six==1.17.0
snowballstemmer==3.0.1
soupsieve==2.7
spdx-tools==0.8.2
Sphinx==8.2.3
sphinx-copybutton==0.5.2
sphinx-reredirects==1.0.0
sphinx_rtd_theme==3.0.2
sphinxcontrib-jquery==4.1
text-unidecode==1.3
tomcli==0.10.1
toml==0.10.2
tomlkit==0.13.2
typecode==30.0.1
typecode_libmagic-system-provided==5.39.210531
typing_extensions==4.15.0rc1
uritools==4.0.3
urllib3==2.5.0
urlpy==0.5
wcwidth==0.2.13
webencodings==0.5.1
wheel==0.45.1
xmltodict==0.14.2
zipp==3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions