diff --git a/micall/tests/test_merge_fastqs.py b/micall/tests/test_merge_fastqs.py new file mode 100644 index 000000000..988f375b6 --- /dev/null +++ b/micall/tests/test_merge_fastqs.py @@ -0,0 +1,49 @@ +import pytest +import os +import sys + +from micall.core.merge_fastqs import main + +FASTQ_DATA_A = """@SEQ_ID_A1 +AAGTCGACGAATG ++ +ABCDEFGHIJKLM""" +FASTQ_DATA_A2 = """@SEQ_ID_A2 +AACCTGAAGGGTT ++ +ABCDEFGHIJKLM""" +FASTQ_DATA_B = """@SEQ_ID_B1 +CCCTAAAGGTTTG ++ +ABCDEFGHIJKLM""" +FASTQ_DATA_B2 = """@SEQ_ID_B2 +ACGTACGTACGTA ++ +ABCDEFGHIJKLM""" + +@pytest.fixture +def fastq_files(tmp_path): + # Create forward and reverse fastq files for two samples: A and B. + fastq1_a = tmp_path / "fastq1_a.fastq" + fastq2_a = tmp_path / "fastq2_a.fastq" + fastq1_b = tmp_path / "fastq1_b.fastq" + fastq2_b = tmp_path / "fastq2_b.fastq" + fastq1_a.write_text(FASTQ_DATA_A) + fastq2_a.write_text(FASTQ_DATA_A2) + fastq1_b.write_text(FASTQ_DATA_B) + fastq2_b.write_text(FASTQ_DATA_B2) + + # Paths for output files + fastq1_result = tmp_path / "fastq1_result.fastq" + fastq2_result = tmp_path / "fastq2_result.fastq" + + args = [str(fastq1_a), str(fastq2_a), str(fastq1_b), str(fastq2_b), '--unzipped', str(fastq1_result), str(fastq2_result)] + return args + +def test_basic_main(fastq_files): + main(fastq_files) + + # Add some assertions + assert os.path.exists(fastq_files[-2]) # assert fastq1_result exists + assert os.path.exists(fastq_files[-1]) # assert fastq2_result exists + # ...plus more assertions to check content of results...