#NEWLINE# def get_test_failure_remarkup( build , tests ) : #NEWLINE# #INDENT# safe_slug = urllib . quote_plus ( build . project . slug ) #NEWLINE# base_commit_failures = get_test_failures_in_base_commit ( build ) #NEWLINE# if ( base_commit_failures is None ) : #NEWLINE# #INDENT# total_failures = [ t for t in tests ] #NEWLINE# failures_in_parent = [ ] #NEWLINE# message = ' There were a total of {num_failures} [test failures]({link}), but we could not determine if any of these tests were previously failing.' . format ( num_failures = len ( tests ) , link = build_uri ( '/build_tests/{0}/' . format ( build . id . hex ) ) ) #NEWLINE# message += '\n\n**All failures ({failure_count}):**\n' . format ( failure_count = len ( total_failures ) ) #NEWLINE# message += _generate_remarkup_table_for_tests ( build , t ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_failures = [ t for t in tests if ( t . name not in base_commit_failures ) ] #NEWLINE# failures_in_parent = [ t for t in tests if ( t . name in base_commit_failures ) ] #NEWLINE# message = ' There were {new_failures} new [test failures]({link})' . format ( new_failures = len ( new_failures ) , link = build_uri ( '/build_tests/{0}/' . format ( build . id . hex ) ) ) #NEWLINE# if new_failures : #NEWLINE# #INDENT# message += '\n\n**New failures ({new_failure_count}):**\n' . format ( new_failure_count = len ( new_failures ) ) #NEWLINE# message += _generate_remarkup_table_for_tests ( build , new_failures ) #NEWLINE# #UNINDENT# #UNINDENT# if failures_in_parent : #NEWLINE# #INDENT# message += '\n\n**Failures in parent revision ({parent_failure_count}):**\n' . format ( parent_failure_count = len ( failures_in_parent ) ) #NEWLINE# message += _generate_remarkup_table_for_tests ( build , failures_in_parent ) #NEWLINE# #UNINDENT# return message