Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a --check flag to the CLI that verifies if archive directory and MD5 file exist without performing backup operations. This allows users to validate existing backups before running new ones.
- Adds
check_backuphelper function to verify archive directory and MD5 file existence - Implements
--checkCLI argument that returns boolean verification result - Adds comprehensive test coverage for the new check functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| seqBackupLib/backup.py | Implements check_backup function and --check CLI flag with early return logic |
| test/test_backup.py | Adds test for check flag behavior including negative cases when MD5 file is missing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return hash_md5.hexdigest() | ||
|
|
||
|
|
||
| def check_backup(forward_reads: Path, dest_dir: Path) -> bool: |
There was a problem hiding this comment.
The function signature is inconsistent with backup_fastq which takes sample_sheet_fp and other parameters. Consider adding sample_sheet_fp parameter for consistency and to enable more comprehensive validation.
| def check_backup(forward_reads: Path, dest_dir: Path) -> bool: | |
| def check_backup(forward_reads: Path, dest_dir: Path, sample_sheet_fp: Path) -> bool: |
|
|
||
|
|
||
| def check_backup(forward_reads: Path, dest_dir: Path) -> bool: | ||
| with gzip.open(forward_reads, mode="rt") as f: |
There was a problem hiding this comment.
Missing error handling for file operations. If forward_reads doesn't exist or isn't a valid gzip file, this will raise an unhandled exception instead of returning False.
Summary
--checkCLI flag to verify archive directory and md5 filecheck_backuphelperTesting
pytest -qhttps://chatgpt.com/codex/tasks/task_e_68a71a0a2c788323a623ceaf00a0cb95