@@ -21,7 +21,8 @@ def with_instrumented_server(auth=False, **ikwargs):
2121 def decorator (f ):
2222 @wraps (f )
2323 def wrapped (self , * args , ** kwargs ):
24- sio = socketio .AsyncServer (async_mode = 'asgi' )
24+ sio = socketio .AsyncServer (async_mode = 'asgi' , ping_interval = 5 ,
25+ ping_timeout = 4 )
2526
2627 @sio .event
2728 async def enter_room (sid , data ):
@@ -107,76 +108,76 @@ def test_missing_auth(self):
107108
108109 @with_instrumented_server (auth = False )
109110 def test_admin_connect_with_no_auth (self ):
110- with socketio .SimpleClient () as admin_client :
111+ with socketio .SimpleClient (reconnection = False ) as admin_client :
111112 admin_client .connect ('http://localhost:8900' , namespace = '/admin' )
112- with socketio .SimpleClient () as admin_client :
113+ with socketio .SimpleClient (reconnection = False ) as admin_client :
113114 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
114115 auth = {'foo' : 'bar' })
115116
116117 @with_instrumented_server (auth = {'foo' : 'bar' })
117118 def test_admin_connect_with_dict_auth (self ):
118- with socketio .SimpleClient () as admin_client :
119+ with socketio .SimpleClient (reconnection = False ) as admin_client :
119120 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
120121 auth = {'foo' : 'bar' })
121- with socketio .SimpleClient () as admin_client :
122+ with socketio .SimpleClient (reconnection = False ) as admin_client :
122123 with pytest .raises (ConnectionError ):
123124 admin_client .connect (
124125 'http://localhost:8900' , namespace = '/admin' ,
125126 auth = {'foo' : 'baz' })
126- with socketio .SimpleClient () as admin_client :
127+ with socketio .SimpleClient (reconnection = False ) as admin_client :
127128 with pytest .raises (ConnectionError ):
128129 admin_client .connect (
129130 'http://localhost:8900' , namespace = '/admin' )
130131
131132 @with_instrumented_server (auth = [{'foo' : 'bar' },
132133 {'u' : 'admin' , 'p' : 'secret' }])
133134 def test_admin_connect_with_list_auth (self ):
134- with socketio .SimpleClient () as admin_client :
135+ with socketio .SimpleClient (reconnection = False ) as admin_client :
135136 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
136137 auth = {'foo' : 'bar' })
137- with socketio .SimpleClient () as admin_client :
138+ with socketio .SimpleClient (reconnection = False ) as admin_client :
138139 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
139140 auth = {'u' : 'admin' , 'p' : 'secret' })
140- with socketio .SimpleClient () as admin_client :
141+ with socketio .SimpleClient (reconnection = False ) as admin_client :
141142 with pytest .raises (ConnectionError ):
142143 admin_client .connect ('http://localhost:8900' ,
143144 namespace = '/admin' , auth = {'foo' : 'baz' })
144- with socketio .SimpleClient () as admin_client :
145+ with socketio .SimpleClient (reconnection = False ) as admin_client :
145146 with pytest .raises (ConnectionError ):
146147 admin_client .connect ('http://localhost:8900' ,
147148 namespace = '/admin' )
148149
149150 @with_instrumented_server (auth = _custom_auth )
150151 def test_admin_connect_with_function_auth (self ):
151- with socketio .SimpleClient () as admin_client :
152+ with socketio .SimpleClient (reconnection = False ) as admin_client :
152153 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
153154 auth = {'foo' : 'bar' })
154- with socketio .SimpleClient () as admin_client :
155+ with socketio .SimpleClient (reconnection = False ) as admin_client :
155156 with pytest .raises (ConnectionError ):
156157 admin_client .connect ('http://localhost:8900' ,
157158 namespace = '/admin' , auth = {'foo' : 'baz' })
158- with socketio .SimpleClient () as admin_client :
159+ with socketio .SimpleClient (reconnection = False ) as admin_client :
159160 with pytest .raises (ConnectionError ):
160161 admin_client .connect ('http://localhost:8900' ,
161162 namespace = '/admin' )
162163
163164 @with_instrumented_server (auth = _async_custom_auth )
164165 def test_admin_connect_with_async_function_auth (self ):
165- with socketio .SimpleClient () as admin_client :
166+ with socketio .SimpleClient (reconnection = False ) as admin_client :
166167 admin_client .connect ('http://localhost:8900' , namespace = '/admin' ,
167168 auth = {'foo' : 'bar' })
168- with socketio .SimpleClient () as admin_client :
169+ with socketio .SimpleClient (reconnection = False ) as admin_client :
169170 with pytest .raises (ConnectionError ):
170171 admin_client .connect ('http://localhost:8900' ,
171172 namespace = '/admin' , auth = {'foo' : 'baz' })
172- with socketio .SimpleClient () as admin_client :
173+ with socketio .SimpleClient (reconnection = False ) as admin_client :
173174 with pytest .raises (ConnectionError ):
174175 admin_client .connect ('http://localhost:8900' ,
175176 namespace = '/admin' )
176177
177178 @with_instrumented_server ()
178179 def test_admin_connect_only_admin (self ):
179- with socketio .SimpleClient () as admin_client :
180+ with socketio .SimpleClient (reconnection = False ) as admin_client :
180181 admin_client .connect ('http://localhost:8900' , namespace = '/admin' )
181182 sid = admin_client .sid
182183 events = self ._expect ({'config' : 1 , 'all_sockets' : 1 ,
@@ -201,10 +202,10 @@ def test_admin_connect_only_admin(self):
201202
202203 @with_instrumented_server ()
203204 def test_admin_connect_with_others (self ):
204- with socketio .SimpleClient () as client1 , \
205- socketio .SimpleClient () as client2 , \
206- socketio .SimpleClient () as client3 , \
207- socketio .SimpleClient () as admin_client :
205+ with socketio .SimpleClient (reconnection = False ) as client1 , \
206+ socketio .SimpleClient (reconnection = False ) as client2 , \
207+ socketio .SimpleClient (reconnection = False ) as client3 , \
208+ socketio .SimpleClient (reconnection = False ) as admin_client :
208209 client1 .connect ('http://localhost:8900' )
209210 client1 .emit ('enter_room' , 'room' )
210211 sid1 = client1 .sid
@@ -251,7 +252,7 @@ def test_admin_connect_with_others(self):
251252
252253 @with_instrumented_server (mode = 'production' , read_only = True )
253254 def test_admin_connect_production (self ):
254- with socketio .SimpleClient () as admin_client :
255+ with socketio .SimpleClient (reconnection = False ) as admin_client :
255256 admin_client .connect ('http://localhost:8900' , namespace = '/admin' )
256257 events = self ._expect ({'config' : 1 , 'server_stats' : 2 },
257258 admin_client )
@@ -272,9 +273,9 @@ def test_admin_connect_production(self):
272273
273274 @with_instrumented_server ()
274275 def test_admin_features (self ):
275- with socketio .SimpleClient () as client1 , \
276- socketio .SimpleClient () as client2 , \
277- socketio .SimpleClient () as admin_client :
276+ with socketio .SimpleClient (reconnection = False ) as client1 , \
277+ socketio .SimpleClient (reconnection = False ) as client2 , \
278+ socketio .SimpleClient (reconnection = False ) as admin_client :
278279 client1 .connect ('http://localhost:8900' )
279280 client2 .connect ('http://localhost:8900' )
280281 admin_client .connect ('http://localhost:8900' , namespace = '/admin' )
0 commit comments