#NEWLINE# @ contextmanager #NEWLINE# def create_test_case( domain , case_type , case_name ) : #NEWLINE# #INDENT# case = CaseFactory ( domain ) . create_case ( case_type = case_type , case_name = case_name ) #NEWLINE# try : #NEWLINE# #INDENT# ( yield case ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if should_use_sql_backend ( domain ) : #NEWLINE# #INDENT# CaseAccessorSQL . hard_delete_cases ( domain , [ case . case_id ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# case . delete ( )