Repository navigation
Test the filesystem on the app data folder against real Drive - #463
Draft
shcheklein wants to merge 2 commits into
Draft
shcheklein wants to merge 2 commits into
shcheklein wants to merge 2 commits into
Conversation
Writes, reads, copies, moves and permanent removal under appDataFolder, which only mocks covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shcheklein
commented
Dec 3, 2026
shcheklein
commented
Dec 3, 2026
shcheklein
left a comment
Member
Author
There was a problem hiding this comment.
[AI generated — Copilot]
5-pass review summary: clean functional live tests with zero monkeypatching/internals. Two things to improve: avoid 8 redundant OAuth token exchanges across 2 tests, and place these 2 tests in test_fs.py rather than adding a 64-line standalone module.
1 of 2 tasks
One module-scoped login covers the app data scope, the test folder is created and deleted by ID, and rmdir first refuses a folder that still holds a file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the added app-data filesystem integration tests.
No open issues 🎉
What changed in this PR
Adds live integration tests for the filesystem’s hidden Drive app data folder, without changing production code.
Changes:
- Adds shared authentication and isolated test folders with permanent cleanup.
- Verifies writes, copies, moves, listings, content, and metadata through a fresh filesystem instance.
- Checks that permanent folder removal refuses nonempty folders and succeeds after their contents are deleted.
| File | Description |
|---|---|
pydrive2/test/test_fs.py |
Adds app data fixtures and two live filesystem tests. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A filesystem can be opened on the app data folder, the hidden per-app folder in a user's Drive:
Its code differs from the rest of the filesystem: every listing asks Drive for the
appDataFolderspace, new IDs are generated for that space, and removing a folder checks the app data scope. Only mocks tested any of it. This adds two live tests on real Drive, intest_fs.py. They share one service-account login with thedrive.appdatascope. Each works in its own folder underappDataFolderand reads back with a new filesystem instance.makedirs,pipe_file,cp_fileandmv, thenlsof the app data folder and of the test folder, detailedfind,infoandcat_file. Sizes and MD5 checksums equal those of the bytes written.trash_only=False:rmdirof a folder that holds a file raisesENOTEMPTYand leaves the file; afterrm_file,rmdirremoves the folder. The emptiness check in app data needs thedrive.appdatascope and must query the app data space, so a check sent to the ordinary space would fail the first step.Not covered here: removal with the default
trash_only=TrueDrive cannot trash files in the app data folder. It answers
403 notSupportedForAppDataFolderFiles("Files within the Application Data folder cannot be trashed", Drive guide). The filesystem trashes by default and has no case for app data, sofs.rm_file("appDataFolder/...")with default options should raise anApiRequestError. What it should do instead needs a decision, and the fix will come with its own live test. These tests remove withtrash_only=False, and their cleanup deletes the test folder by ID.Validation
Test-only change. The tests pass against the local fake Drive as a smoke check, after teaching the fake the
appDataFolderalias. They are expected to pass on real Drive. If one fails, it has found a bug, and the fix goes in its own PR.🤖 Generated with Claude Code