Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #11 Mock file operations Tests #156

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

ShirshenduR
Copy link
Contributor

@ShirshenduR ShirshenduR commented Oct 27, 2024

Description

This pull request addresses issue #11 by adding tests for the add_or_update_normal_file function in twinTrim/dataStructures/fileMetadata.py. The objective is to mock file operations, such as file access, to simulate various file system behaviors, including scenarios where files exist and do not. This ensures that the function behaves as expected without relying on the actual file system, thus improving test reliability and speed.

Type of change

  • Implemented mocking for file access in the tests using pytest to simulate different file scenarios.
  • Created specific test cases that cover:
    • Adding a new file when it does not exist in the normalStore.
    • Updating existing file metadata when a file already exists.
  • Verified that the function handles these cases correctly without performing actual file operations.

These changes enhance the test suite's coverage and ensure that the add_or_update_normal_file function is robust against various file system states.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have maintained a clean commit history by using the necessary Git commands
  • I have checked that my code does not cause any merge conflicts

Screenshots (if applicable)

Screenshot_20241028_124214_Chrome

@ShirshenduR
Copy link
Contributor Author

@techy4shri @Kota-Karthik please review

@Kota-Karthik
Copy link
Owner

@ShirshenduR LGTM!
but can you just add a screenshot showing that all tests work fine !

@ShirshenduR
Copy link
Contributor Author

ShirshenduR commented Oct 28, 2024

Please check the screenshot below @Kota-Karthik
Screenshot_20241028_124214_Chrome

@Kota-Karthik
Copy link
Owner

LGTM!
@ShirshenduR

@Kota-Karthik Kota-Karthik merged commit 177cb0d into Kota-Karthik:main Oct 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock File Operations in add_or_update_normal_file
3 participants