def test_is_bam_compression_possible_no_bam(crunchy_config_dict, bam_path): """Test bam_compression_possible for non-existing BAM""" # GIVEN a bam path to non existing file and a crunchy api crunchy_api = CrunchyAPI(crunchy_config_dict) # WHEN calling test_bam_compression_possible result = crunchy_api.is_bam_compression_possible(bam_path=bam_path) # THEN this should return False assert not result
def test_is_bam_compression_possible(crunchy_config_dict, crunchy_test_dir): """Test bam_compression_possible compressable BAM""" # GIVEN a bam path to existing file and a crunchy api crunchy_api = CrunchyAPI(crunchy_config_dict) bam_path = crunchy_test_dir / "file.bam" bam_path.touch() # WHEN calling test_bam_compression_possible result = crunchy_api.is_bam_compression_possible(bam_path=bam_path) # THEN this will return True assert result
def test_is_bam_compression_possible_cram_done(crunchy_config_dict, crunchy_test_dir, mock_bam_to_cram, mocker): """Test bam_compression_possible for existing compression""" # GIVEN a bam path to a existing file and a crunchy api mocker.patch.object(CrunchyAPI, "bam_to_cram", side_effect=mock_bam_to_cram) crunchy_api = CrunchyAPI(crunchy_config_dict) bam_path = crunchy_test_dir / "file.bam" bam_path.touch() # WHEN calling test_bam_compression_possible when cram_compression is done crunchy_api.bam_to_cram(bam_path=bam_path, dry_run=False, ntasks=1, mem=2) result = crunchy_api.is_bam_compression_possible(bam_path=bam_path) # THEN this should return False assert not result