Skip to content

No issue: test_filecmp: Add tests for filecmp.cmp cache hit and overf… - #159076

Closed
Bolotnyj wants to merge 1 commit into
python:mainfrom
Bolotnyj:filecmp-cache-tests
Closed

Bolotnyj wants to merge 1 commit into
python:mainfrom
Bolotnyj:filecmp-cache-tests

Conversation

@Bolotnyj

@Bolotnyj Bolotnyj commented Oct 9, 2026

Copy link
Copy Markdown

Summary

This PR adds missing unit tests for the filecmp module to validate its caching behavior and automatic cache clearing mechanism.

Changes

  • Added test_cmp_cache_hit to verify that successful cache hits return consistent results without computing file properties again.
  • Added test_cmp_cache_clearing_on_overflow to ensure that filecmp._cache triggers a reset and effectively limits its size when capacity exceeds 100 entries.

Tested locally using coverage, ensuring full coverage of the internal cache conditional blocks.

@python-cla-bot

python-cla-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@bedevere-app bedevere-app Bot added awaiting review tests Tests in the Lib/test dir labels Oct 9, 2026
@bedevere-app

bedevere-app Bot commented Oct 9, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@Bolotnyj Bolotnyj closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant