Skip to content

Commit 48cc695

Browse files
committed
socketio test connection is working 🎉 (with the correct python-socketio version)
1 parent 1cd174a commit 48cc695

File tree

4 files changed

+80
-22
lines changed

4 files changed

+80
-22
lines changed

‎poetry.lock

+58-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ license = "GPLv2"
88
[tool.poetry.dependencies]
99
python = "^3.9"
1010
psutil = "^5.8.0"
11-
websocket_client = "^0.57.0"
1211
pytest = "^6.2.2"
1312
requests = "^2.25.1"
1413
invoke = "^1.5.0"
1514
pathlib = "^1.0.1"
15+
asyncio = "^3.4.3"
16+
python-socketio = "^4"
1617

1718
[tool.poetry.dev-dependencies]
1819

‎test/conftest.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import pytest
88
from invoke import Local
99
from invoke.context import Context
10-
10+
import socketio as io
11+
import asyncio
1112

1213
@pytest.fixture(scope="function")
1314
def agent(pytestconfig):
@@ -43,3 +44,10 @@ def agent(pytestconfig):
4344
@pytest.fixture(scope="session")
4445
def base_url():
4546
return "http://127.0.0.1:8991"
47+
48+
@pytest.fixture(scope="session")
49+
def socketio(base_url, data=""):
50+
sio = io.Client()
51+
sio.connect(base_url)
52+
yield sio
53+
sio.disconnect()

‎test/test_ws.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import asyncio
2+
import socketio as io
3+
import time
4+
5+
def test_ws_connection(agent, socketio):
6+
print('my sid is', socketio.sid)
7+
assert socketio.sid is not None
8+
9+
def test_list(agent, socketio):
10+
socketio.emit('command', 'list')
11+

0 commit comments

Comments
 (0)