Skip to content

Fix mkdir without parents for simple relative paths - #3484

Open
student-shivamm wants to merge 1 commit into
spotify:masterfrom
student-shivamm:codex/relative-mkdir
Open

student-shivamm wants to merge 1 commit into
spotify:masterfrom
student-shivamm:codex/relative-mkdir

Conversation

@student-shivamm

Copy link
Copy Markdown

Description

Fix LocalFileSystem.mkdir("relative", parents=False) incorrectly raising MissingParentDirectory when the current working directory exists.

For a path with no directory component, os.path.dirname(path) returns an empty string. Use os.curdir for that parent check. The behavior for nested paths remains covered by the tests.

Motivation and Context

A simple relative path should work like ./relative when creating a directory without creating missing parents. The public FileSystem.mkdir contract raises MissingParentDirectory when the parent does not exist.

Have you tested this? If so, how?

I have included unit tests. The parametrized test uses actual temporary directories for relative, ./relative, and parent/relative, and checks existing-directory and missing-parent exceptions.

  • Upstream plus these tests: the simple-relative case fails; the two relative-path controls pass.
  • Focused filesystem tests: 8 passed on Windows, Python 3.13.5.
  • Full test/local_target_test.py comparison: upstream 31 failed / 63 passed / 3 errors; candidate 30 failed / 64 passed / 3 errors. The only changed test outcome is the new regression passing. The same existing Windows failures and cleanup errors remain, including unavailable compression executables and file-handle deletion behavior.
  • Ruff 0.17.5 lint and format checks pass on both changed files; git diff --check passes.
  • Full tox/core/platform CI was not run.

AI assistance was used for investigation, implementation and local validation.

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