🧪 Add robust tests for Manifest.save#46
Conversation
This commit enhances the test coverage for the `Manifest.save` method in `src/mapcv/writer.py`. Changes: - Added `test_manifest_save_exact_content` to verify exact JSON output and indentation. - Added `test_manifest_save_non_existent_dir` to verify error handling for missing directories. - Added `test_manifest_save_permission_error` to verify error handling for read-only files, including robustness for root environments. These additions ensure that the manifest serialization remains consistent and handles filesystem edge cases correctly. Co-authored-by: tahamukhtar20 <91777330+tahamukhtar20@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The testing gap addressed
The
Manifest.savemethod inwriter.pywas previously only covered by basic round-trip tests. This PR adds more targeted tests to ensure the output format (JSON with 2-space indentation) is strictly maintained and that filesystem errors are handled correctly.📊 Coverage: What scenarios are now tested
test_manifest_save_exact_contentverifies the exact JSON string against Pydantic'smodel_dump_json(indent=2).test_manifest_save_non_existent_dirensuresFileNotFoundErroris raised if the target path's parent doesn't exist.test_manifest_save_permission_errorensuresOSErroris raised when writing is prohibited, with a built-in check to skip the test if running as root (wherechmodmight be bypassed).✨ Result: The improvement in test coverage
Increased the reliability of the dataset manifest generation by ensuring consistent formatting and robust error handling for disk I/O operations.
PR created automatically by Jules for task 16697052113663297211 started by @tahamukhtar20