#NEWLINE# @ patch ( 'prestoadmin.main.crawl' ) #NEWLINE# @ patch ( 'prestoadmin.fabric_patches.crawl' ) #NEWLINE# def test_too_many_args( self , crawl_mock , crawl_mock_main ) : #NEWLINE# #INDENT# def task( arg1 ) : #NEWLINE# #INDENT# 'This is my task' #NEWLINE# pass #NEWLINE# #UNINDENT# crawl_mock . return_value = self #NEWLINE# crawl_mock_main . return_value = task #NEWLINE# state . env . nodeps = False #NEWLINE# try : #NEWLINE# #INDENT# main . run_tasks ( [ ( 'my task' , [ 'arg1' , 'arg2' ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , [ ] , [ ] , [ ] ) ] ) #NEWLINE# #UNINDENT# except SystemExit as e : #NEWLINE# #INDENT# self . assertEqual ( e . code , 2 ) #NEWLINE# #UNINDENT# self . assertEqual ( "Incorrect number of arguments to task.\n\nDisplaying detailed information for task 'my task':\n\n    This is my task\n\n" , self . test_stdout . getvalue ( ) )