#NEWLINE# def test_mock_decorators_and_args( self ) : #NEWLINE# #INDENT# "Ensure that mocked objects are called correctly in the arguments.\n\n        See `FuncMockArgsDecoratorsChecker' docstring for details.\n        " #NEWLINE# errors = [ ] #NEWLINE# for ( dirname , dirnames , filenames ) in os . walk ( self . tests_path ) : #NEWLINE# #INDENT# for filename in filenames : #NEWLINE# #INDENT# if ( ( not filename . startswith ( 'test_' ) ) or ( not filename . endswith ( '.py' ) ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# filename = os . path . relpath ( os . path . join ( dirname , filename ) ) #NEWLINE# with open ( filename , 'rb' ) as fh : #NEWLINE# #INDENT# tree = ast . parse ( fh . read ( ) , filename ) #NEWLINE# #UNINDENT# visitor = FuncMockArgsDecoratorsChecker ( ) #NEWLINE# visitor . visit ( tree ) #NEWLINE# errors . extend ( ( dict ( filename = filename , ** error ) for error in visitor . errors ) ) #NEWLINE# #UNINDENT# #UNINDENT# if errors : #NEWLINE# #INDENT# print ( FuncMockArgsDecoratorsChecker . __doc__ ) #NEWLINE# print ( '\n\nThe following errors were found during the described check:' ) #NEWLINE# for error in errors : #NEWLINE# #INDENT# print ( ( '\n\nErrors at file %(filename)s line %(lineno)d:\n\n%(message)s' % { #NEWLINE# #INDENT# 'message' : '\n' . join ( error [ 'messages' ] ) , #NEWLINE# 'filename' : error [ 'filename' ] , #NEWLINE# 'lineno' : error [ 'lineno' ] , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# #UNINDENT# for error in errors : #NEWLINE# #INDENT# error [ 'messages' ] = [ message . rstrip ( ) . replace ( '\n' , '  ' ) . replace ( '\t' , '' ) for message in error [ 'messages' ] ] #NEWLINE# #UNINDENT# self . assertEqual ( [ ] , errors )