File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ def backup_fastq(
111111 with open (md5_out_fp , "w" ) as md5_out :
112112 [md5_out .write ("\t " .join (md5 ) + "\n " ) for md5 in md5s ]
113113
114+ return write_dir
115+
114116
115117def main (argv = None ):
116118 parser = argparse .ArgumentParser (description = "Backs up fastq files" )
@@ -143,8 +145,7 @@ def main(argv=None):
143145 help = "Minimum file size to register in bytes" ,
144146 )
145147 args = parser .parse_args (argv )
146-
147- backup_fastq (
148+ return backup_fastq (
148149 args .forward_reads ,
149150 args .destination_dir ,
150151 args .sample_sheet ,
Original file line number Diff line number Diff line change 11import pytest
22from pathlib import Path
3- from seqBackupLib .backup import backup_fastq , build_fp_to_archive , return_md5
3+ from seqBackupLib .backup import (
4+ backup_fastq ,
5+ build_fp_to_archive ,
6+ return_md5 ,
7+ main ,
8+ )
49
510
611def test_build_fp_to_archive ():
@@ -104,3 +109,26 @@ def test_backup_fastq_without_lane(tmp_path, full_miseq_dir):
104109 out_dir = raw / "250407_M03543_0443_000000000-DTHBL_L001"
105110 assert (out_dir / "Undetermined_S0_L001_R1_001.fastq.gz" ).is_file ()
106111 assert (out_dir / "Undetermined_S0_L001_R2_001.fastq.gz" ).is_file ()
112+
113+
114+ def test_main_returns_archive_path (tmp_path , full_miseq_dir ):
115+ raw = tmp_path / "raw_reads"
116+ raw .mkdir (parents = True , exist_ok = True )
117+ sample_sheet_fp = full_miseq_dir / "sample_sheet.csv"
118+
119+ out_dir = main (
120+ [
121+ "--forward-reads" ,
122+ str (full_miseq_dir / "Undetermined_S0_L001_R1_001.fastq.gz" ),
123+ "--destination-dir" ,
124+ str (raw ),
125+ "--sample-sheet" ,
126+ str (sample_sheet_fp ),
127+ "--min-file-size" ,
128+ "100" ,
129+ ]
130+ )
131+
132+ expected_dir = raw / "250407_M03543_0443_000000000-DTHBL_L001"
133+ assert out_dir == expected_dir
134+ assert expected_dir .is_dir ()
You can’t perform that action at this time.
0 commit comments