#NEWLINE# def add_post_hook( self , request , results ) : #NEWLINE# #INDENT# if hasattr ( self , 'post_process' ) : #NEWLINE# #INDENT# cb = request . callback #NEWLINE# @ wraps ( cb ) #NEWLINE# def wrapper( response ) : #NEWLINE# #INDENT# output = list ( iterate_spider_output ( cb ( response ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# results . startTest ( self . testcase_post ) #NEWLINE# self . post_process ( output ) #NEWLINE# results . stopTest ( self . testcase_post ) #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# results . addFailure ( self . testcase_post , sys . exc_info ( ) ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# results . addError ( self . testcase_post , sys . exc_info ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# results . addSuccess ( self . testcase_post ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# return output #NEWLINE# #UNINDENT# #UNINDENT# request . callback = wrapper #NEWLINE# #UNINDENT# return request