Skip to content

Preserve memory filesystem entries when renaming to the same path - #441

Open
rioyu123 wants to merge 1 commit into
google:mainfrom
rioyu123:codex/pyglove-same-path-rename
Open

rioyu123 wants to merge 1 commit into
google:mainfrom
rioyu123:codex/pyglove-same-path-rename

Conversation

@rioyu123

Copy link
Copy Markdown

MemoryFileSystem.rename(path, path) currently deletes an existing file or empty directory. For a nonempty directory, it raises OSError: Directory not empty instead of leaving it alone.

Return early when the destination resolves to the same entry as the source. The missing-source check still runs first, and renaming to a different destination keeps its existing behavior.

Added regressions for file contents, empty and nonempty directories, and a missing path. On Linux with Python 3.12 and 3.14, the suite passes using the project's split CI pattern:

  • pytest -n 4 --ignore=pyglove/dev/reloader_test.py --cov=pyglove --cov-report=xml: 1,722 passed, 1 skipped on each version.
  • pytest pyglove/dev/reloader_test.py --cov=pyglove --cov-append --cov-report=xml: 4 passed on each version.

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