コード例 #1
0
def test_is_fastq_compression_possible_compression_pending(
        crunchy_config_dict: dict, compression_object: CompressionData,
        caplog):
    """Test if FASTQ compression is possible when FASTQ compression is pending

    This means that there should exist a FASTQ compression flag
    """
    caplog.set_level(logging.DEBUG)
    # GIVEN a crunchy-api, and existing FASTQ paths
    crunchy_api = CrunchyAPI(crunchy_config_dict)
    compression_object.fastq_first.touch()
    compression_object.fastq_second.touch()
    # GIVEN that the pending path exists
    compression_object.pending_path.touch()
    # GIVEN no SPRING file exists
    spring_file = compression_object.spring_path
    assert not spring_file.exists()

    # WHEN checking if SPRING compression is done
    result = crunchy_api.is_fastq_compression_possible(compression_object)

    # THEN result should be False since the compression flag exists
    assert result is False
    # THEN assert that the correct message was communicated
    assert "Compression/decompression is pending for" in caplog.text
コード例 #2
0
def test_is_fastq_compression_possible_spring_exists(
        crunchy_config_dict: dict, compression_object: CompressionData,
        caplog):
    """Test if FASTQ compression is possible when FASTQ compression is done

    This means that the SPRING file exists
    """
    caplog.set_level(logging.DEBUG)
    # GIVEN a crunchy-api, and existing FASTQ paths
    crunchy_api = CrunchyAPI(crunchy_config_dict)
    # GIVEN that the SPRING path exists
    compression_object.spring_path.touch()
    spring_file = compression_object.spring_path
    assert spring_file.exists()

    # WHEN checking if SPRING compression is done
    result = crunchy_api.is_fastq_compression_possible(compression_object)

    # THEN result should be False since the compression flag exists
    assert result is False
    # THEN assert that the correct message was communicated
    assert "SPRING file found" in caplog.text
コード例 #3
0
def test_is_fastq_compression_possible(crunchy_config_dict: dict,
                                       compression_object: CompressionData,
                                       caplog):
    """Test if FASTQ compression is possible under correct circumstances

    This means that there should exist FASTQ files but no SPRING archive
    """
    caplog.set_level(logging.DEBUG)
    # GIVEN a crunchy-api, and existing FASTQ paths
    crunchy_api = CrunchyAPI(crunchy_config_dict)
    compression_object.fastq_first.touch()
    compression_object.fastq_second.touch()
    # GIVEN no SPRING file exists
    spring_file = compression_object.spring_path
    assert not spring_file.exists()

    # WHEN checking if SPRING compression is done
    result = crunchy_api.is_fastq_compression_possible(compression_object)

    # THEN result should be True
    assert result is True
    # THEN assert that the correct message was communicated
    assert "FASTQ compression is possible" in caplog.text