#NEWLINE# def run( self ) : #NEWLINE# #INDENT# if self . distribution . install_requires : #NEWLINE# #INDENT# self . distribution . fetch_build_eggs ( self . distribution . install_requires ) #NEWLINE# #UNINDENT# if self . distribution . tests_require : #NEWLINE# #INDENT# self . distribution . fetch_build_eggs ( self . distribution . tests_require ) #NEWLINE# #UNINDENT# self . run_command ( 'egg_info' ) #NEWLINE# build_ext_cmd = self . reinitialize_command ( 'build_ext' ) #NEWLINE# build_ext_cmd . inplace = 1 #NEWLINE# self . run_command ( 'build_ext' ) #NEWLINE# from test import unittest , MotorTestLoader , MotorTestRunner , test_environment as testenv #NEWLINE# loader = MotorTestLoader ( ) #NEWLINE# loader . avoid ( 'high_availability' , 'Runs separately' ) #NEWLINE# if ( not ( testenv . HAVE_ASYNCIO or testenv . HAVE_TORNADO ) ) : #NEWLINE# #INDENT# raise ImportError ( 'No tornado nor asyncio' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not testenv . HAVE_TORNADO ) : #NEWLINE# #INDENT# loader . avoid ( 'tornado_tests' , reason = 'no tornado' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not testenv . HAVE_ASYNCIO ) : #NEWLINE# #INDENT# loader . avoid ( 'asyncio_tests' , reason = 'no asyncio' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( sys . version_info [ : 2 ] < ( 3 , 5 ) ) : #NEWLINE# #INDENT# loader . avoid ( 'asyncio_tests.test_asyncio_await' , reason = 'python < 3.5' ) #NEWLINE# #UNINDENT# test_motor_await = 'tornado_tests.test_motor_await' #NEWLINE# if ( not testenv . HAVE_TORNADO ) : #NEWLINE# #INDENT# loader . avoid ( test_motor_await , reason = 'no tornado' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not ( testenv . TORNADO_VERSION [ : 2 ] > ( 4 , 2 ) ) ) : #NEWLINE# #INDENT# loader . avoid ( test_motor_await , reason = 'tornado < 4.3' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sys . version_info [ : 2 ] < ( 3 , 5 ) ) : #NEWLINE# #INDENT# loader . avoid ( test_motor_await , reason = 'python < 3.5' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( self . test_suite is None ) : #NEWLINE# #INDENT# suite = loader . discover ( self . test_module ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suite = loader . loadTestsFromName ( self . test_suite ) #NEWLINE# #UNINDENT# runner_kwargs = dict ( verbosity = 2 , failfast = self . failfast , tornado_warnings = self . tornado_warnings ) #NEWLINE# if ( ( sys . version_info [ : 2 ] >= ( 3 , 2 ) ) and ( unittest . __name__ != 'unittest2' ) ) : #NEWLINE# #INDENT# runner_kwargs [ 'warnings' ] = 'default' #NEWLINE# #UNINDENT# runner = MotorTestRunner ( ** runner_kwargs ) #NEWLINE# result = runner . run ( suite ) #NEWLINE# sys . exit ( ( not result . wasSuccessful ( ) ) )