#NEWLINE# def _do_discovery( self , argv , Loader = defaultTestLoaderCls ) : #NEWLINE# #INDENT# if ( not have_discover ) : #NEWLINE# #INDENT# raise AssertionError ( 'Unable to use discovery, must use python 2.7 or greater, or install the discover package.' ) #NEWLINE# #UNINDENT# self . progName = ( '%s discover' % self . progName ) #NEWLINE# import optparse #NEWLINE# parser = optparse . OptionParser ( ) #NEWLINE# parser . prog = self . progName #NEWLINE# parser . add_option ( '-v' , '--verbose' , dest = 'verbose' , default = False , help = 'Verbose output' , action = 'store_true' ) #NEWLINE# if ( self . failfast != False ) : #NEWLINE# #INDENT# parser . add_option ( '-f' , '--failfast' , dest = 'failfast' , default = False , help = 'Stop on first fail or error' , action = 'store_true' ) #NEWLINE# #UNINDENT# if ( self . catchbreak != False ) : #NEWLINE# #INDENT# parser . add_option ( '-c' , '--catch' , dest = 'catchbreak' , default = False , help = 'Catch ctrl-C and display results so far' , action = 'store_true' ) #NEWLINE# #UNINDENT# if ( self . buffer != False ) : #NEWLINE# #INDENT# parser . add_option ( '-b' , '--buffer' , dest = 'buffer' , default = False , help = 'Buffer stdout and stderr during tests' , action = 'store_true' ) #NEWLINE# #UNINDENT# parser . add_option ( '-s' , '--start-directory' , dest = 'start' , default = '.' , help = "Directory to start discovery ('.' default)" ) #NEWLINE# parser . add_option ( '-p' , '--pattern' , dest = 'pattern' , default = 'test*.py' , help = "Pattern to match tests ('test*.py' default)" ) #NEWLINE# parser . add_option ( '-t' , '--top-level-directory' , dest = 'top' , default = None , help = 'Top level directory of project (defaults to start directory)' ) #NEWLINE# parser . add_option ( '-l' , '--list' , dest = 'listtests' , default = False , help = 'List tests rather than running them.' ) #NEWLINE# parser . add_option ( '--load-list' , dest = 'load_list' , default = None , help = 'Specify a filename containing the test ids to use.' ) #NEWLINE# ( options , args ) = parser . parse_args ( argv ) #NEWLINE# if ( len ( args ) > 3 ) : #NEWLINE# #INDENT# self . usageExit ( ) #NEWLINE# #UNINDENT# for ( name , value ) in zip ( ( 'start' , 'pattern' , 'top' ) , args ) : #NEWLINE# #INDENT# setattr ( options , name , value ) #NEWLINE# #UNINDENT# if ( self . failfast is None ) : #NEWLINE# #INDENT# self . failfast = options . failfast #NEWLINE# #UNINDENT# if ( self . catchbreak is None ) : #NEWLINE# #INDENT# self . catchbreak = options . catchbreak #NEWLINE# #UNINDENT# if ( self . buffer is None ) : #NEWLINE# #INDENT# self . buffer = options . buffer #NEWLINE# #UNINDENT# self . listtests = options . listtests #NEWLINE# self . load_list = options . load_list #NEWLINE# if options . verbose : #NEWLINE# #INDENT# self . verbosity = 2 #NEWLINE# #UNINDENT# start_dir = options . start #NEWLINE# pattern = options . pattern #NEWLINE# top_level_dir = options . top #NEWLINE# loader = Loader ( ) #NEWLINE# self . test = loader . discover ( start_dir , pattern , top_level_dir )