Skip to content

Test same-name files and a folder renamed by another client on real Drive - #462

Draft
shcheklein wants to merge 2 commits into
mainfrom
live-other-clients
Draft

shcheklein wants to merge 2 commits into
mainfrom
live-other-clients

Conversation

@shcheklein

@shcheklein shcheklein commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

The second set of live tests from the review of what CI never ran against real Drive (the first is #457). These cover a folder that another client changed: someone using the Drive web page, another DVC process, or a script. They are in test_fs.py and use its fixtures; the other client is the core API.

Two files with one name

Drive lets two files in a folder have the same name. DVC users get them from two pushes that race, or from an upload in the web page. The guide says the filesystem then uses the file with the lowest Drive ID. Only mocks checked that; the existing live test_ops_work_with_duplicate_names covers duplicate folders.

# another client created two files named same.txt in a folder
fs.ls("root/dir")                   # ['root/dir/same.txt', 'root/dir/same.txt']
fs.cat_file("root/dir/same.txt")    # the content of the file with the lower ID
fs.rm_file("root/dir/same.txt")     # removes that one; the other stays

The tests check ls, cat_file, info, detailed find and rm_file against real Drive.

A folder renamed after the filesystem cached it

The filesystem caches folder IDs by path. The guide says to call fs.invalidate_cache(path) after another client moves, trashes or deletes a folder. In the test, another client renames before to after after the filesystem listed it. After invalidate_cache("root/dir/before"), before and its file no longer exist, and the file reads under after. A folder replaced after caching is already covered by test_invalidating_parent_reloads_replaced_mount.

Validation

Test-only change. The tests pass against the local fake Drive as a smoke check. They describe what the guide already promises, so they are expected to pass on real Drive too. If one fails, it has found a bug, and the fix goes in its own PR.

🤖 Generated with Claude Code

Two files with one name, and a folder that another client replaced or
renamed after the filesystem cached its ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread pydrive2/test/test_fs_other_clients.py Resolved
Comment thread pydrive2/test/test_fs_other_clients.py Resolved

@shcheklein shcheklein left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI generated — Copilot]

5-pass review summary: clean, idiomatic functional live tests with zero monkeypatching and zero internals. Main critique is creating another standalone test file that copy-pastes ~35% of its code (fixtures/helpers) from #457 instead of living in test_fs.py or sharing conftest.py fixtures.

Comment thread pydrive2/test/test_fs_other_clients.py Resolved
Comment thread pydrive2/test/test_fs_other_clients.py Resolved
They use its fixtures and keep the created folder object instead of
listing to find it. The replaced-folder case is dropped:
test_invalidating_parent_reloads_replaced_mount covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shcheklein shcheklein changed the title Test same-name files and folders changed by another client on real Drive Test same-name files and a folder renamed by another client on real Drive Dec 3, 2026
@shcheklein
shcheklein requested a balanced review from Copilot December 3, 2026 20:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the added live Drive filesystem tests and supporting helpers.

No open issues 🎉

What changed in this PR

Extends live Drive filesystem coverage following #457, testing changes made by another client without modifying production code.

Changes:

  • Tests duplicate-name file listing, lowest-ID selection, metadata, and removal.
  • Tests that cache invalidation resolves an externally renamed folder correctly.
  • Adds shared helpers for creating test items through the core Drive API.
File Description
pydrive2/​test/​test_fs.py Adds duplicate-file and external-folder-rename tests with supporting fixtures.

Review effort: Balanced

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.

2 participants