Skip to content

Commit e59acf1

Browse files
Address failures of test suite on Mac (#1497)
1 parent 36a8922 commit e59acf1

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

tests/async/test_admin.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,76 +107,76 @@ def test_missing_auth(self):
107107

108108
@with_instrumented_server(auth=False)
109109
def test_admin_connect_with_no_auth(self):
110-
with socketio.SimpleClient() as admin_client:
110+
with socketio.SimpleClient(reconnection=False) as admin_client:
111111
admin_client.connect('http://localhost:8900', namespace='/admin')
112-
with socketio.SimpleClient() as admin_client:
112+
with socketio.SimpleClient(reconnection=False) as admin_client:
113113
admin_client.connect('http://localhost:8900', namespace='/admin',
114114
auth={'foo': 'bar'})
115115

116116
@with_instrumented_server(auth={'foo': 'bar'})
117117
def test_admin_connect_with_dict_auth(self):
118-
with socketio.SimpleClient() as admin_client:
118+
with socketio.SimpleClient(reconnection=False) as admin_client:
119119
admin_client.connect('http://localhost:8900', namespace='/admin',
120120
auth={'foo': 'bar'})
121-
with socketio.SimpleClient() as admin_client:
121+
with socketio.SimpleClient(reconnection=False) as admin_client:
122122
with pytest.raises(ConnectionError):
123123
admin_client.connect(
124124
'http://localhost:8900', namespace='/admin',
125125
auth={'foo': 'baz'})
126-
with socketio.SimpleClient() as admin_client:
126+
with socketio.SimpleClient(reconnection=False) as admin_client:
127127
with pytest.raises(ConnectionError):
128128
admin_client.connect(
129129
'http://localhost:8900', namespace='/admin')
130130

131131
@with_instrumented_server(auth=[{'foo': 'bar'},
132132
{'u': 'admin', 'p': 'secret'}])
133133
def test_admin_connect_with_list_auth(self):
134-
with socketio.SimpleClient() as admin_client:
134+
with socketio.SimpleClient(reconnection=False) as admin_client:
135135
admin_client.connect('http://localhost:8900', namespace='/admin',
136136
auth={'foo': 'bar'})
137-
with socketio.SimpleClient() as admin_client:
137+
with socketio.SimpleClient(reconnection=False) as admin_client:
138138
admin_client.connect('http://localhost:8900', namespace='/admin',
139139
auth={'u': 'admin', 'p': 'secret'})
140-
with socketio.SimpleClient() as admin_client:
140+
with socketio.SimpleClient(reconnection=False) as admin_client:
141141
with pytest.raises(ConnectionError):
142142
admin_client.connect('http://localhost:8900',
143143
namespace='/admin', auth={'foo': 'baz'})
144-
with socketio.SimpleClient() as admin_client:
144+
with socketio.SimpleClient(reconnection=False) as admin_client:
145145
with pytest.raises(ConnectionError):
146146
admin_client.connect('http://localhost:8900',
147147
namespace='/admin')
148148

149149
@with_instrumented_server(auth=_custom_auth)
150150
def test_admin_connect_with_function_auth(self):
151-
with socketio.SimpleClient() as admin_client:
151+
with socketio.SimpleClient(reconnection=False) as admin_client:
152152
admin_client.connect('http://localhost:8900', namespace='/admin',
153153
auth={'foo': 'bar'})
154-
with socketio.SimpleClient() as admin_client:
154+
with socketio.SimpleClient(reconnection=False) as admin_client:
155155
with pytest.raises(ConnectionError):
156156
admin_client.connect('http://localhost:8900',
157157
namespace='/admin', auth={'foo': 'baz'})
158-
with socketio.SimpleClient() as admin_client:
158+
with socketio.SimpleClient(reconnection=False) as admin_client:
159159
with pytest.raises(ConnectionError):
160160
admin_client.connect('http://localhost:8900',
161161
namespace='/admin')
162162

163163
@with_instrumented_server(auth=_async_custom_auth)
164164
def test_admin_connect_with_async_function_auth(self):
165-
with socketio.SimpleClient() as admin_client:
165+
with socketio.SimpleClient(reconnection=False) as admin_client:
166166
admin_client.connect('http://localhost:8900', namespace='/admin',
167167
auth={'foo': 'bar'})
168-
with socketio.SimpleClient() as admin_client:
168+
with socketio.SimpleClient(reconnection=False) as admin_client:
169169
with pytest.raises(ConnectionError):
170170
admin_client.connect('http://localhost:8900',
171171
namespace='/admin', auth={'foo': 'baz'})
172-
with socketio.SimpleClient() as admin_client:
172+
with socketio.SimpleClient(reconnection=False) as admin_client:
173173
with pytest.raises(ConnectionError):
174174
admin_client.connect('http://localhost:8900',
175175
namespace='/admin')
176176

177177
@with_instrumented_server()
178178
def test_admin_connect_only_admin(self):
179-
with socketio.SimpleClient() as admin_client:
179+
with socketio.SimpleClient(reconnection=False) as admin_client:
180180
admin_client.connect('http://localhost:8900', namespace='/admin')
181181
sid = admin_client.sid
182182
events = self._expect({'config': 1, 'all_sockets': 1,
@@ -201,10 +201,10 @@ def test_admin_connect_only_admin(self):
201201

202202
@with_instrumented_server()
203203
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:
204+
with socketio.SimpleClient(reconnection=False) as client1, \
205+
socketio.SimpleClient(reconnection=False) as client2, \
206+
socketio.SimpleClient(reconnection=False) as client3, \
207+
socketio.SimpleClient(reconnection=False) as admin_client:
208208
client1.connect('http://localhost:8900')
209209
client1.emit('enter_room', 'room')
210210
sid1 = client1.sid
@@ -251,7 +251,7 @@ def test_admin_connect_with_others(self):
251251

252252
@with_instrumented_server(mode='production', read_only=True)
253253
def test_admin_connect_production(self):
254-
with socketio.SimpleClient() as admin_client:
254+
with socketio.SimpleClient(reconnection=False) as admin_client:
255255
admin_client.connect('http://localhost:8900', namespace='/admin')
256256
events = self._expect({'config': 1, 'server_stats': 2},
257257
admin_client)
@@ -272,9 +272,9 @@ def test_admin_connect_production(self):
272272

273273
@with_instrumented_server()
274274
def test_admin_features(self):
275-
with socketio.SimpleClient() as client1, \
276-
socketio.SimpleClient() as client2, \
277-
socketio.SimpleClient() as admin_client:
275+
with socketio.SimpleClient(reconnection=False) as client1, \
276+
socketio.SimpleClient(reconnection=False) as client2, \
277+
socketio.SimpleClient(reconnection=False) as admin_client:
278278
client1.connect('http://localhost:8900')
279279
client2.connect('http://localhost:8900')
280280
admin_client.connect('http://localhost:8900', namespace='/admin')

tests/common/test_admin.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,62 +97,62 @@ def test_missing_auth(self):
9797

9898
@with_instrumented_server(auth=False)
9999
def test_admin_connect_with_no_auth(self):
100-
with socketio.SimpleClient() as admin_client:
100+
with socketio.SimpleClient(reconnection=False) as admin_client:
101101
admin_client.connect('http://localhost:8900', namespace='/admin')
102-
with socketio.SimpleClient() as admin_client:
102+
with socketio.SimpleClient(reconnection=False) as admin_client:
103103
admin_client.connect('http://localhost:8900', namespace='/admin',
104104
auth={'foo': 'bar'})
105105

106106
@with_instrumented_server(auth={'foo': 'bar'})
107107
def test_admin_connect_with_dict_auth(self):
108-
with socketio.SimpleClient() as admin_client:
108+
with socketio.SimpleClient(reconnection=False) as admin_client:
109109
admin_client.connect('http://localhost:8900', namespace='/admin',
110110
auth={'foo': 'bar'})
111-
with socketio.SimpleClient() as admin_client:
111+
with socketio.SimpleClient(reconnection=False) as admin_client:
112112
with pytest.raises(ConnectionError):
113113
admin_client.connect(
114114
'http://localhost:8900', namespace='/admin',
115115
auth={'foo': 'baz'})
116-
with socketio.SimpleClient() as admin_client:
116+
with socketio.SimpleClient(reconnection=False) as admin_client:
117117
with pytest.raises(ConnectionError):
118118
admin_client.connect(
119119
'http://localhost:8900', namespace='/admin')
120120

121121
@with_instrumented_server(auth=[{'foo': 'bar'},
122122
{'u': 'admin', 'p': 'secret'}])
123123
def test_admin_connect_with_list_auth(self):
124-
with socketio.SimpleClient() as admin_client:
124+
with socketio.SimpleClient(reconnection=False) as admin_client:
125125
admin_client.connect('http://localhost:8900', namespace='/admin',
126126
auth={'foo': 'bar'})
127-
with socketio.SimpleClient() as admin_client:
127+
with socketio.SimpleClient(reconnection=False) as admin_client:
128128
admin_client.connect('http://localhost:8900', namespace='/admin',
129129
auth={'u': 'admin', 'p': 'secret'})
130-
with socketio.SimpleClient() as admin_client:
130+
with socketio.SimpleClient(reconnection=False) as admin_client:
131131
with pytest.raises(ConnectionError):
132132
admin_client.connect('http://localhost:8900',
133133
namespace='/admin', auth={'foo': 'baz'})
134-
with socketio.SimpleClient() as admin_client:
134+
with socketio.SimpleClient(reconnection=False) as admin_client:
135135
with pytest.raises(ConnectionError):
136136
admin_client.connect('http://localhost:8900',
137137
namespace='/admin')
138138

139139
@with_instrumented_server(auth=_custom_auth)
140140
def test_admin_connect_with_function_auth(self):
141-
with socketio.SimpleClient() as admin_client:
141+
with socketio.SimpleClient(reconnection=False) as admin_client:
142142
admin_client.connect('http://localhost:8900', namespace='/admin',
143143
auth={'foo': 'bar'})
144-
with socketio.SimpleClient() as admin_client:
144+
with socketio.SimpleClient(reconnection=False) as admin_client:
145145
with pytest.raises(ConnectionError):
146146
admin_client.connect('http://localhost:8900',
147147
namespace='/admin', auth={'foo': 'baz'})
148-
with socketio.SimpleClient() as admin_client:
148+
with socketio.SimpleClient(reconnection=False) as admin_client:
149149
with pytest.raises(ConnectionError):
150150
admin_client.connect('http://localhost:8900',
151151
namespace='/admin')
152152

153153
@with_instrumented_server()
154154
def test_admin_connect_only_admin(self):
155-
with socketio.SimpleClient() as admin_client:
155+
with socketio.SimpleClient(reconnection=False) as admin_client:
156156
admin_client.connect('http://localhost:8900', namespace='/admin')
157157
sid = admin_client.sid
158158
events = self._expect({'config': 1, 'all_sockets': 1,
@@ -177,10 +177,10 @@ def test_admin_connect_only_admin(self):
177177

178178
@with_instrumented_server()
179179
def test_admin_connect_with_others(self):
180-
with socketio.SimpleClient() as client1, \
181-
socketio.SimpleClient() as client2, \
182-
socketio.SimpleClient() as client3, \
183-
socketio.SimpleClient() as admin_client:
180+
with socketio.SimpleClient(reconnection=False) as client1, \
181+
socketio.SimpleClient(reconnection=False) as client2, \
182+
socketio.SimpleClient(reconnection=False) as client3, \
183+
socketio.SimpleClient(reconnection=False) as admin_client:
184184
client1.connect('http://localhost:8900')
185185
client1.emit('enter_room', 'room')
186186
sid1 = client1.sid
@@ -227,7 +227,7 @@ def test_admin_connect_with_others(self):
227227

228228
@with_instrumented_server(mode='production', read_only=True)
229229
def test_admin_connect_production(self):
230-
with socketio.SimpleClient() as admin_client:
230+
with socketio.SimpleClient(reconnection=False) as admin_client:
231231
admin_client.connect('http://localhost:8900', namespace='/admin')
232232
events = self._expect({'config': 1, 'server_stats': 2},
233233
admin_client)
@@ -248,9 +248,9 @@ def test_admin_connect_production(self):
248248

249249
@with_instrumented_server()
250250
def test_admin_features(self):
251-
with socketio.SimpleClient() as client1, \
252-
socketio.SimpleClient() as client2, \
253-
socketio.SimpleClient() as admin_client:
251+
with socketio.SimpleClient(reconnection=False) as client1, \
252+
socketio.SimpleClient(reconnection=False) as client2, \
253+
socketio.SimpleClient(reconnection=False) as admin_client:
254254
client1.connect('http://localhost:8900')
255255
client2.connect('http://localhost:8900')
256256
admin_client.connect('http://localhost:8900', namespace='/admin')

tests/web_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_environ(self):
4747
env['gunicorn.socket'] = self.connection
4848
return env
4949

50-
self.httpd = make_server('', port, self._app_wrapper,
50+
self.httpd = make_server('localhost', port, self._app_wrapper,
5151
ThreadingWSGIServer, WebSocketRequestHandler)
5252
self.thread = threading.Thread(target=self.httpd.serve_forever)
5353
self.thread.start()

0 commit comments

Comments
 (0)