镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix broken test_license_reference_to_file_beside_package_manifest test #4540 - #4811

Open
xovishnukosuri wants to merge 1 commit into
aboutcode-org:developfrom
xovishnukosuri:fix/test-broken-record-file-references-4540
Open

xovishnukosuri wants to merge 1 commit into
aboutcode-org:developfrom
xovishnukosuri:fix/test-broken-record-file-references-4540

Conversation

@xovishnukosuri

Copy link
Copy Markdown

Summary

  • Remove non-existent file entries (beartype/meta.py and beartype/py.typed) from the test RECORD file at tests/packagedcode/data/license_detection/reference-to-license-beside-manifest/beartype-0.17.2/beartype-0.17.2.dist-info/RECORD
  • Update the expected JSON to remove the corresponding file_references entries

Root Cause

The RECORD file in the beartype test data referenced beartype/meta.py and beartype/py.typed, but only beartype/__init__.py actually exists in the test data directory. With importlib_metadata >= 8.0 (after python/importlib_metadata#437 -- "Distribution.files: Only return files that actually exist"), get_file_references() in src/packagedcode/pypi.py returns fewer file references than the expected JSON contains, causing the test assertion to fail.

Fix

Rather than adding the missing files (which would bloat the test data with unnecessary files), this PR removes the two phantom entries from the RECORD file so it only lists files that are present. The expected JSON is updated accordingly.

This makes the test data self-consistent and compatible with both old and new versions of importlib_metadata.

Fixes #4540

Test plan

  • Run pytest -k test_license_reference_to_file_beside_package_manifest tests/packagedcode/test_license_detection.py and confirm it passes with both pinned and newer importlib_metadata versions

🤖 Generated with Claude Code

…importlib_metadata

Remove non-existent file entries (beartype/meta.py and beartype/py.typed)
from the test RECORD file and update the expected JSON accordingly.

The RECORD file referenced files that don't exist in the test data
directory. With importlib_metadata >= 8.0 (after python/importlib_metadata#437),
Distribution.files only returns files that actually exist on disk, causing
get_file_references() to return fewer entries than expected and breaking
the test.

Fixes aboutcode-org#4540

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_license_reference_to_file_beside_package_manifest test is broken

1 participant