test(tools): comprehensive test suite for file_operations module (+51 tests) - #167
Open
manus-use wants to merge 1 commit into
Open
test(tools): comprehensive test suite for file_operations module (+51 tests)#167manus-use wants to merge 1 commit into
manus-use wants to merge 1 commit into
Conversation
… tests) Add tests for all five utility functions in file_operations.py: file_read (10 tests): - Text/binary/empty/unicode/large file reading - Tilde expansion, spaces in filenames - FileNotFoundError, ValueError for directories file_write (9 tests): - Create new, overwrite existing, nested dir creation - create_dirs=False error path, empty/unicode/multiline content - Tilde expansion, return message validation file_list (9 tests): - Empty dir, files+dirs, glob patterns, recursive glob - Missing dir, not-a-dir, hidden files, relative paths - Default directory argument file_delete (7 tests): - Files, empty dirs, recursive (force=True) - Non-empty without force, nonexistent path - Symlink behavior (resolve follows target), sibling preservation file_move (9 tests): - Basic move, rename, cross-directory - Parent dir creation, overwrite, existing dest no overwrite - Missing source, directory move, message validation Integration (7 tests): - Write→read round trip, write→list, write→move→read - Write→delete→verify gone, list after delete - Move→read original fails, write nested→list pattern All tests use tmp_path fixtures — no real filesystem side effects.
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.
Summary
Comprehensive test suite for the
file_operationsmodule (src/manus_agent/tools/file_operations.py), which provides five core file utility functions used throughout the agent.Test Coverage
file_read— 10 testsfile_write— 9 testscreate_dirs=True)create_dirs=Falsewith missing parentfile_list— 9 tests*.py), recursive glob (**/*.py)file_delete— 7 testsforce=True)file_move— 9 testsIntegration — 7 tests
Technical Notes
tmp_pathfixtures (pytest-managed temp directories)resolve()follows symlinks before delete)Files Changed
tests/test_file_operations.py— new test file (51 tests)