def test_add_custom_errors2(): log = "sometext some text some other text " + \ "Exception: File is empty (1234567890abcdefg.regionPeak.gz) some other text" eh = AWSEMErrorHandler() eh.add_custom_errors([{ "error_type": "No peak called", "pattern": "Exception: File is empty (.+.regionPeak.gz)" }]) res = eh.parse_log(log) assert res with pytest.raises(AWSEMJobErrorException) as exec_info: raise res assert 'No peak called' in str(exec_info.value) assert '1234567890abcdefg.regionPeak.gz' in str(exec_info.value)
def test_add_custom_errors(): log = "[M::mem_pestat] low and high boundaries for proper pairs: (1, 22)" + \ "[mem_sam_pe] paired reads have different names: " + \ "\"H3MVTCCXX:4:1101:1174861:0\", \"H3MVTCCXX:4:1101:743397:0\"" eh = AWSEMErrorHandler() eh.add_custom_errors([{ "error_type": "Unmatching pairs in fastq", "pattern": "paired reads have different names: .+", "multiline": False }]) assert len(eh.ErrorList) == len(eh._ErrorList) + 1 res = eh.parse_log(log) assert res with pytest.raises(AWSEMJobErrorException) as exec_info: raise res assert 'Unmatching pairs in fastq' in str(exec_info.value) assert 'H3MVTCCXX:4:1101:1174861:0' in str(exec_info.value)