#NEWLINE# def run( verbosity = 1 , doctest = False , numpy = True ) : #NEWLINE# #INDENT# 'Run NetworkX tests.\n\n    Parameters\n    ----------\n    verbosity: integer, optional\n      Level of detail in test reports.  Higher numbers provide  more detail.  \n\n    doctest: bool, optional\n      True to run doctests in code modules\n\n    numpy: bool, optional\n      True to test modules dependent on numpy\n    ' #NEWLINE# try : #NEWLINE# #INDENT# import nose #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# raise ImportError ( 'The nose package is needed to run the NetworkX tests.' ) #NEWLINE# #UNINDENT# sys . stderr . write ( 'Running NetworkX tests:' ) #NEWLINE# nx_install_dir = path . join ( path . dirname ( __file__ ) , path . pardir ) #NEWLINE# if ( getcwd ( ) == path . abspath ( path . join ( nx_install_dir , path . pardir ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( "Can't run tests from source directory.\nRun 'nosetests' from the command line." ) #NEWLINE# #UNINDENT# argv = [ ' ' , ( '--verbosity=%d' % verbosity ) , '-w' , nx_install_dir , '-exe' ] #NEWLINE# if doctest : #NEWLINE# #INDENT# argv . extend ( [ '--with-doctest' , '--doctest-extension=txt' ] ) #NEWLINE# #UNINDENT# if ( not nx_install_dir ) : #NEWLINE# #INDENT# argv . extend ( [ '-A not numpy' ] ) #NEWLINE# #UNINDENT# nose . run ( argv = argv )