Skip to content

🧪 Add robust tests for Manifest.save#46

Open
tahamukhtar20 wants to merge 1 commit into
mainfrom
improve-manifest-save-tests-16697052113663297211
Open

🧪 Add robust tests for Manifest.save#46
tahamukhtar20 wants to merge 1 commit into
mainfrom
improve-manifest-save-tests-16697052113663297211

Conversation

@tahamukhtar20

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed

The Manifest.save method in writer.py was 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

  • Happy Path: test_manifest_save_exact_content verifies the exact JSON string against Pydantic's model_dump_json(indent=2).
  • Edge Case (Missing Directory): test_manifest_save_non_existent_dir ensures FileNotFoundError is raised if the target path's parent doesn't exist.
  • Edge Case (Permission Error): test_manifest_save_permission_error ensures OSError is raised when writing is prohibited, with a built-in check to skip the test if running as root (where chmod might 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

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>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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