#NEWLINE# def test_single_user_spawner( db , io_loop ) : #NEWLINE# #INDENT# spawner = new_spawner ( db , cmd = [ 'jupyterhub-singleuser' ] ) #NEWLINE# io_loop . run_sync ( spawner . start ) #NEWLINE# assert ( spawner . user . server . ip == '127.0.0.1' ) #NEWLINE# def wait( ) : #NEWLINE# #INDENT# return spawner . user . server . wait_up ( timeout = 1 , http = True ) #NEWLINE# #UNINDENT# for i in range ( 30 ) : #NEWLINE# #INDENT# status = io_loop . run_sync ( spawner . poll ) #NEWLINE# assert ( status is None ) #NEWLINE# try : #NEWLINE# #INDENT# io_loop . run_sync ( wait ) #NEWLINE# #UNINDENT# except TimeoutError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# io_loop . run_sync ( wait ) #NEWLINE# status = io_loop . run_sync ( spawner . poll ) #NEWLINE# assert ( status == None ) #NEWLINE# io_loop . run_sync ( spawner . stop ) #NEWLINE# status = io_loop . run_sync ( spawner . poll ) #NEWLINE# assert ( status == 0 )