Skip to content

Commit 9c7d3f8

Browse files
committed
fix tests: "socketio.exceptions.ConnectionError: Connection refused by the server"
1 parent fc1222e commit 9c7d3f8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def agent(pytestconfig):
4545
def base_url():
4646
return "http://127.0.0.1:8991"
4747

48-
@pytest.fixture(scope="session")
49-
def socketio(base_url, data=""):
48+
@pytest.fixture(scope="function")
49+
def socketio(base_url, agent):
5050
sio = io.Client()
5151
sio.connect(base_url)
5252
yield sio

test/test_ws.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import socketio
21
import time
32

4-
def test_ws_connection(agent, socketio):
3+
def test_ws_connection(socketio):
54
print('my sid is', socketio.sid)
65
assert socketio.sid is not None
76

8-
def test_list(agent, socketio):
7+
def test_list(socketio):
98
socketio.on('message', message_handler)
109
socketio.emit('command', 'list')
1110
time.sleep(.1)
1211

13-
def test__open_serial_default(agent, socketio):
12+
def test__open_serial_default(socketio):
1413
socketio.on('message', message_handler)
1514
socketio.emit('command', 'open /dev/ttyACM0 9600')
1615
time.sleep(.1)

0 commit comments

Comments
 (0)