Skip to content

Tolerate missing directories in removedirs_p - #268

Open
fhgffy wants to merge 1 commit into
jaraco:mainfrom
fhgffy:fix-removedirs-missing-20261011
Open

fhgffy wants to merge 1 commit into
jaraco:mainfrom
fhgffy:fix-removedirs-missing-20261011

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 10, 2026

Copy link
Copy Markdown

Path.removedirs_p() documents that missing directories are tolerated, but currently raises FileNotFoundError for an absent directory or parent. This adds that exception to the existing suppression, so repeated cleanup of an already removed tree is harmless.

Regression coverage includes a missing leaf, a missing parent, repeated removal, and an existing file that must still raise. The three missing-directory cases fail on the original code; all functional tests and doctests pass afterward (140 passed, 7 platform skips), with 100% coverage of the changed source line. Formatting, documentation build/lint, wheel/sdist build, and twine check pass on Python 3.12/Windows.

The full pytest check configuration still reports seven Ruff file checks and one mypy unused-ignore failure. I ran the same checks on the original source and verified the complete static-diagnostic sequence is unchanged; these failures predate this patch.

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.

1 participant